diff --git a/assets/.htaccess b/assets/.htaccess new file mode 100644 index 000000000..efa53b69c --- /dev/null +++ b/assets/.htaccess @@ -0,0 +1,33 @@ + + ExpiresActive on + ExpiresDefault "access plus 1 month" + + # CSS + ExpiresByType text/css "access plus 1 year" + + # JavaScript + ExpiresByType application/javascript "access plus 1 year" + ExpiresByType application/x-javascript "access plus 1 year" + ExpiresByType text/javascript "access plus 1 year" + + # Web fonts + + # Embedded OpenType (EOT) + ExpiresByType application/vnd.ms-fontobject "access plus 1 month" + ExpiresByType font/eot "access plus 1 month" + + # OpenType + ExpiresByType font/opentype "access plus 1 month" + + # TrueType + ExpiresByType application/x-font-ttf "access plus 1 month" + + # Web Open Font Format (WOFF) 1.0 + ExpiresByType application/font-woff "access plus 1 month" + ExpiresByType application/x-font-woff "access plus 1 month" + ExpiresByType font/woff "access plus 1 month" + + # Web Open Font Format (WOFF) 2.0 + ExpiresByType application/font-woff2 "access plus 1 month" + + diff --git a/assets/icons.f41c5641.ttf b/assets/063d0ba7099c5ef73aa81a6a50e5767f.ttf similarity index 100% rename from assets/icons.f41c5641.ttf rename to assets/063d0ba7099c5ef73aa81a6a50e5767f.ttf diff --git a/assets/1.f2d7a0b2fe91a8ac18a0.js b/assets/1.f2d7a0b2fe91a8ac18a0.js new file mode 100644 index 000000000..41b09bc06 --- /dev/null +++ b/assets/1.f2d7a0b2fe91a8ac18a0.js @@ -0,0 +1,16 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{"+Ewk":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default="2.5.2"},"+RWU":function(t,e,n){"use strict";t.exports=function(t,e,n){if("GET"!==e.method)return void n(new Error("Method "+e.method+" "+t+" is not supported by JSONP."));e.debug("JSONP: start");var o=!1,s=!1;i+=1;var a=document.getElementsByTagName("head")[0],u=document.createElement("script"),c="algoliaJSONP_"+i,l=!1;window[c]=function(t){!function(){try{delete window[c],delete window[c+"_loaded"]}catch(t){window[c]=window[c+"_loaded"]=void 0}}(),s?e.debug("JSONP: Late answer, ignoring"):(o=!0,f(),n(null,{body:t,responseText:JSON.stringify(t)}))},t+="&callback="+c,e.jsonBody&&e.jsonBody.params&&(t+="&"+e.jsonBody.params);var h=setTimeout(function(){e.debug("JSONP: Script timeout"),s=!0,f(),n(new r.RequestTimeout)},e.timeouts.complete);function p(){e.debug("JSONP: success"),l||s||(l=!0,o||(e.debug("JSONP: Fail. Script loaded but did not call the callback"),f(),n(new r.JSONPScriptFail)))}function f(){clearTimeout(h),u.onload=null,u.onreadystatechange=null,u.onerror=null,a.removeChild(u)}u.onreadystatechange=function(){"loaded"!==this.readyState&&"complete"!==this.readyState||p()},u.onload=p,u.onerror=function(){if(e.debug("JSONP: Script error"),l||s)return;f(),n(new r.JSONPScriptError)},u.async=!0,u.defer=!0,u.src=t,a.appendChild(u)};var r=n("Z4lL"),i=0},"/kzE":function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(e,r){t.exports=function(t){var e=function(){var e,r,i,o,s,a,u=[],c=u.concat,l=u.filter,h=u.slice,p=t.document,f={},d={},m={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},g=/^\s*<(\w+|!)[^>]*>/,y=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,b=/^(?:body|html)$/i,w=/([A-Z])/g,_=["val","css","html","text","data","width","height","offset"],x=p.createElement("table"),S=p.createElement("tr"),C={tr:p.createElement("tbody"),tbody:x,thead:x,tfoot:x,td:S,th:S,"*":p.createElement("div")},A=/complete|loaded|interactive/,T=/^[\w-]*$/,k={},E=k.toString,O={},N=p.createElement("div"),j={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},R=Array.isArray||function(t){return t instanceof Array};function I(t){return null==t?String(t):k[E.call(t)]||"object"}function P(t){return"function"==I(t)}function D(t){return null!=t&&t==t.window}function $(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function L(t){return"object"==I(t)}function q(t){return L(t)&&!D(t)&&Object.getPrototypeOf(t)==Object.prototype}function M(t){var e=!!t&&"length"in t&&t.length,n=i.type(t);return"function"!=n&&!D(t)&&("array"==n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function H(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function F(t){return t in d?d[t]:d[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function U(t,e){return"number"!=typeof e||m[H(t)]?e:e+"px"}function B(t){return"children"in t?h.call(t.children):i.map(t.childNodes,function(t){if(1==t.nodeType)return t})}function V(t,e){var n,r=t?t.length:0;for(n=0;n")),n===e&&(n=g.test(t)&&RegExp.$1),n in C||(n="*"),(a=C[n]).innerHTML=""+t,o=i.each(h.call(a.childNodes),function(){a.removeChild(this)})),q(r)&&(s=i(o),i.each(r,function(t,e){_.indexOf(t)>-1?s[t](e):s.attr(t,e)})),o},O.Z=function(t,e){return new V(t,e)},O.isZ=function(t){return t instanceof O.Z},O.init=function(t,n){var r;if(!t)return O.Z();if("string"==typeof t)if("<"==(t=t.trim())[0]&&g.test(t))r=O.fragment(t,RegExp.$1,n),t=null;else{if(n!==e)return i(n).find(t);r=O.qsa(p,t)}else{if(P(t))return i(p).ready(t);if(O.isZ(t))return t;if(R(t))r=function(t){return l.call(t,function(t){return null!=t})}(t);else if(L(t))r=[t],t=null;else if(g.test(t))r=O.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==e)return i(n).find(t);r=O.qsa(p,t)}}return O.Z(r,t)},(i=function(t,e){return O.init(t,e)}).extend=function(t){var n,i=h.call(arguments,1);return"boolean"==typeof t&&(n=t,t=i.shift()),i.forEach(function(i){!function t(n,i,o){for(r in i)o&&(q(i[r])||R(i[r]))?(q(i[r])&&!q(n[r])&&(n[r]={}),R(i[r])&&!R(n[r])&&(n[r]=[]),t(n[r],i[r],o)):i[r]!==e&&(n[r]=i[r])}(t,i,n)}),t},O.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,s=T.test(o);return t.getElementById&&s&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:h.call(s&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},i.contains=p.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},i.type=I,i.isFunction=P,i.isWindow=D,i.isArray=R,i.isPlainObject=q,i.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},i.isNumeric=function(t){var e=Number(t),r=n(t);return null!=t&&"boolean"!=r&&("string"!=r||t.length)&&!isNaN(e)&&isFinite(e)||!1},i.inArray=function(t,e,n){return u.indexOf.call(e,t,n)},i.camelCase=s,i.trim=function(t){return null==t?"":String.prototype.trim.call(t)},i.uuid=0,i.support={},i.expr={},i.noop=function(){},i.map=function(t,e){var n,r,o,s=[];if(M(t))for(r=0;r0?i.fn.concat.apply([],t):t}(s)},i.each=function(t,e){var n,r;if(M(t)){for(n=0;n=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return u.every.call(this,function(e,n){return!1!==t.call(e,n,e)}),this},filter:function(t){return P(t)?this.not(this.not(t)):i(l.call(this,function(e){return O.matches(e,t)}))},add:function(t,e){return i(a(this.concat(i(t,e))))},is:function(t){return this.length>0&&O.matches(this[0],t)},not:function(t){var n=[];if(P(t)&&t.call!==e)this.each(function(e){t.call(this,e)||n.push(this)});else{var r="string"==typeof t?this.filter(t):M(t)&&P(t.item)?h.call(t):i(t);this.forEach(function(t){r.indexOf(t)<0&&n.push(t)})}return i(n)},has:function(t){return this.filter(function(){return L(t)?i.contains(this,t):i(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!L(t)?t:i(t)},last:function(){var t=this[this.length-1];return t&&!L(t)?t:i(t)},find:function(t){var e=this;return t?"object"==n(t)?i(t).filter(function(){var t=this;return u.some.call(e,function(e){return i.contains(e,t)})}):1==this.length?i(O.qsa(this[0],t)):this.map(function(){return O.qsa(this,t)}):i()},closest:function(t,e){var r=[],o="object"==n(t)&&i(t);return this.each(function(n,i){for(;i&&!(o?o.indexOf(i)>=0:O.matches(i,t));)i=i!==e&&!$(i)&&i.parentNode;i&&r.indexOf(i)<0&&r.push(i)}),i(r)},parents:function(t){for(var e=[],n=this;n.length>0;)n=i.map(n,function(t){if((t=t.parentNode)&&!$(t)&&e.indexOf(t)<0)return e.push(t),t});return K(e,t)},parent:function(t){return K(a(this.pluck("parentNode")),t)},children:function(t){return K(this.map(function(){return B(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||h.call(this.childNodes)})},siblings:function(t){return K(this.map(function(t,e){return l.call(B(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return i.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=function(t){var e,n;f[t]||(e=p.createElement(t),p.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),f[t]=n);return f[t]}(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=P(t);if(this[0]&&!e)var n=i(t).get(0),r=n.parentNode||this.length>1;return this.each(function(o){i(this).wrapAll(e?t.call(this,o):r?n.cloneNode(!0):n)})},wrapAll:function(t){if(this[0]){var e;for(i(this[0]).before(t=i(t));(e=t.children()).length;)t=e.first();i(t).append(this)}return this},wrapInner:function(t){var e=P(t);return this.each(function(n){var r=i(this),o=r.contents(),s=e?t.call(this,n):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){i(this).replaceWith(i(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var n=i(this);(t===e?"none"==n.css("display"):t)?n.show():n.hide()})},prev:function(t){return i(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return i(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;i(this).empty().append(J(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=J(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,n){var i;return"string"!=typeof t||1 in arguments?this.each(function(e){if(1===this.nodeType)if(L(t))for(r in t)z(this,r,t[r]);else z(this,t,J(this,n,e,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(i=this[0].getAttribute(t))?i:e},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){z(this,t)},this)})},prop:function(t,e){return t=j[t]||t,1 in arguments?this.each(function(n){this[t]=J(this,e,n,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=j[t]||t,this.each(function(){delete this[t]})},data:function(t,n){var r="data-"+t.replace(w,"-$1").toLowerCase(),i=1 in arguments?this.attr(r,n):this.attr(r);return null!==i?X(i):e},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=J(this,t,e,this.value)})):this[0]&&(this[0].multiple?i(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(e){if(e)return this.each(function(t){var n=i(this),r=J(this,e,t,n.offset()),o=n.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==n.css("position")&&(s.position="relative"),n.css(s)});if(!this.length)return null;if(p.documentElement!==this[0]&&!i.contains(p.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+t.pageXOffset,top:n.top+t.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(t,e){if(arguments.length<2){var n=this[0];if("string"==typeof t){if(!n)return;return n.style[s(t)]||getComputedStyle(n,"").getPropertyValue(t)}if(R(t)){if(!n)return;var o={},a=getComputedStyle(n,"");return i.each(t,function(t,e){o[e]=n.style[s(e)]||a.getPropertyValue(e)}),o}}var u="";if("string"==I(t))e||0===e?u=H(t)+":"+U(t,e):this.each(function(){this.style.removeProperty(H(t))});else for(r in t)t[r]||0===t[r]?u+=H(r)+":"+U(r,t[r])+";":this.each(function(){this.style.removeProperty(H(r))});return this.each(function(){this.style.cssText+=";"+u})},index:function(t){return t?this.indexOf(i(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return!!t&&u.some.call(this,function(t){return this.test(W(t))},F(t))},addClass:function(t){return t?this.each(function(e){if("className"in this){o=[];var n=W(this),r=J(this,t,e,n);r.split(/\s+/g).forEach(function(t){i(this).hasClass(t)||o.push(t)},this),o.length&&W(this,n+(n?" ":"")+o.join(" "))}}):this},removeClass:function(t){return this.each(function(n){if("className"in this){if(t===e)return W(this,"");o=W(this),J(this,t,n,o).split(/\s+/g).forEach(function(t){o=o.replace(F(t)," ")}),W(this,o.trim())}})},toggleClass:function(t,n){return t?this.each(function(r){var o=i(this),s=J(this,t,r,W(this));s.split(/\s+/g).forEach(function(t){(n===e?!o.hasClass(t):n)?o.addClass(t):o.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var n="scrollTop"in this[0];return t===e?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var n="scrollLeft"in this[0];return t===e?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=b.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(i(t).css("margin-top"))||0,n.left-=parseFloat(i(t).css("margin-left"))||0,r.top+=parseFloat(i(e[0]).css("border-top-width"))||0,r.left+=parseFloat(i(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||p.body;t&&!b.test(t.nodeName)&&"static"==i(t).css("position");)t=t.offsetParent;return t})}},i.fn.detach=i.fn.remove,["width","height"].forEach(function(t){var n=t.replace(/./,function(t){return t[0].toUpperCase()});i.fn[t]=function(r){var o,s=this[0];return r===e?D(s)?s["inner"+n]:$(s)?s.documentElement["scroll"+n]:(o=this.offset())&&o[t]:this.each(function(e){(s=i(this)).css(t,J(this,r,e,s[t]()))})}}),["after","prepend","before","append"].forEach(function(n,r){var o=r%2;i.fn[n]=function(){var n,s,a=i.map(arguments,function(t){var r=[];return"array"==(n=I(t))?(t.forEach(function(t){return t.nodeType!==e?r.push(t):i.zepto.isZ(t)?r=r.concat(t.get()):void(r=r.concat(O.fragment(t)))}),r):"object"==n||null==t?t:O.fragment(t)}),u=this.length>1;return a.length<1?this:this.each(function(e,n){s=o?n:n.parentNode,n=0==r?n.nextSibling:1==r?n.firstChild:2==r?n:null;var c=i.contains(p.documentElement,s);a.forEach(function(e){if(u)e=e.cloneNode(!0);else if(!s)return i(e).remove();s.insertBefore(e,n),c&&function t(e,n){n(e);for(var r=0,i=e.childNodes.length;r500&&void 0!==t.body&&(void 0!==t.body.params||void 0!==t.body.requests)?(t.body.apiKey=this.apiKey,s=this._computeRequestHeaders({additionalUA:u,withApiKey:!1,headers:t.headers})):s=this._computeRequestHeaders({additionalUA:u,headers:t.headers}),void 0!==t.body&&(e=l(t.body)),a("request start");var g=[];function y(t,e,n){return p._useCache&&t&&e&&void 0!==e[n]}function v(e,n){if(y(p._useRequestCache,c,o)&&e.catch(function(){delete c[o]}),"function"!=typeof t.callback)return e.then(n);e.then(function(e){i(function(){t.callback(null,n(e))},p._setTimeout||setTimeout)},function(e){i(function(){t.callback(e)},p._setTimeout||setTimeout)})}if(p._useCache&&p._useRequestCache&&(o=t.url),p._useCache&&p._useRequestCache&&e&&(o+="_body_"+e),y(p._useRequestCache,c,o)){a("serving request from cache");var b=c[o];return v("function"!=typeof b.then?p._promise.resolve({responseText:b}):b,function(t){return JSON.parse(t.responseText)})}var w=function n(i,v){p._checkAppIdData();var b=new Date;if(p._useCache&&!p._useRequestCache&&(o=t.url),p._useCache&&!p._useRequestCache&&e&&(o+="_body_"+v.body),y(!p._useRequestCache,c,o)){a("serving response from cache");var w=c[o];return p._promise.resolve({body:JSON.parse(w),responseText:w})}if(f>=p.hosts[t.hostType].length)return!m||d?(a("could not get any response"),p._promise.reject(new r.AlgoliaSearchError("Cannot connect to the AlgoliaSearch API. Send an email to support@algolia.com to report and resolve the issue. Application id was: "+p.applicationID,{debugData:g}))):(a("switching to fallback"),f=0,v.method=t.fallback.method,v.url=t.fallback.url,v.jsonBody=t.fallback.body,v.jsonBody&&(v.body=l(v.jsonBody)),s=p._computeRequestHeaders({additionalUA:u,headers:t.headers}),v.timeouts=p._getTimeoutsForRequest(t.hostType),p._setHostIndexByType(0,t.hostType),d=!0,n(p._request.fallback,v));var _=p._getHostByType(t.hostType),x=_+v.url,S={body:v.body,jsonBody:v.jsonBody,method:v.method,headers:s,timeouts:v.timeouts,debug:a,forceAuthHeaders:v.forceAuthHeaders};return a("method: %s, url: %s, headers: %j, timeouts: %d",S.method,x,S.headers,S.timeouts),i===p._request.fallback&&a("using fallback"),i.call(p,x,S).then(function(t){var n=t&&t.body&&t.body.message&&t.body.status||t.statusCode||t&&t.body&&200;a("received response: statusCode: %s, computed statusCode: %d, headers: %j",t.statusCode,n,t.headers);var i=2===Math.floor(n/100),u=new Date;if(g.push({currentHost:_,headers:h(s),content:e||null,contentLength:void 0!==e?e.length:null,method:v.method,timeouts:v.timeouts,url:v.url,startTime:b,endTime:u,duration:u-b,statusCode:n}),i)return p._useCache&&!p._useRequestCache&&c&&(c[o]=t.responseText),{responseText:t.responseText,body:t.body};if(4!==Math.floor(n/100))return f+=1,C();a("unrecoverable error");var l=new r.AlgoliaSearchError(t.body&&t.body.message,{debugData:g,statusCode:n});return p._promise.reject(l)},function(o){a("error: %s, stack: %s",o.message,o.stack);var u=new Date;return g.push({currentHost:_,headers:h(s),content:e||null,contentLength:void 0!==e?e.length:null,method:v.method,timeouts:v.timeouts,url:v.url,startTime:b,endTime:u,duration:u-b}),o instanceof r.AlgoliaSearchError||(o=new r.Unknown(o&&o.message,o)),f+=1,o instanceof r.Unknown||o instanceof r.UnparsableJSON||f>=p.hosts[t.hostType].length&&(d||!m)?(o.debugData=g,p._promise.reject(o)):o instanceof r.RequestTimeout?(a("retrying request with higher timeout"),p._incrementHostIndex(t.hostType),p._incrementTimeoutMultipler(),v.timeouts=p._getTimeoutsForRequest(t.hostType),n(i,v)):C()});function C(){return a("retrying request"),p._incrementHostIndex(t.hostType),n(i,v)}}(p._request,{url:t.url,method:t.method,body:e,jsonBody:t.body,timeouts:p._getTimeoutsForRequest(t.hostType),forceAuthHeaders:t.forceAuthHeaders});return p._useCache&&p._useRequestCache&&c&&(c[o]=w),v(w,function(t){return t.body})},u.prototype._getSearchParams=function(t,e){if(void 0===t||null===t)return e;for(var n in t)null!==n&&void 0!==t[n]&&t.hasOwnProperty(n)&&(e+=""===e?"":"&",e+=n+"="+encodeURIComponent("[object Array]"===Object.prototype.toString.call(t[n])?l(t[n]):t[n]));return e},u.prototype._computeRequestHeaders=function(t){var e=n("v61W"),r={"x-algolia-agent":t.additionalUA?this._ua+";"+t.additionalUA:this._ua,"x-algolia-application-id":this.applicationID};return!1!==t.withApiKey&&(r["x-algolia-api-key"]=this.apiKey),this.userToken&&(r["x-algolia-usertoken"]=this.userToken),this.securityTags&&(r["x-algolia-tagfilters"]=this.securityTags),e(this.extraHeaders,function(t,e){r[e]=t}),t.headers&&e(t.headers,function(t,e){r[e]=t}),r},u.prototype.search=function(t,e,r){var i=n("49sm"),o=n("7Ule");if(!i(t))throw new Error("Usage: client.search(arrayOfQueries[, callback])");"function"==typeof e?(r=e,e={}):void 0===e&&(e={});var s=this,a={requests:o(t,function(t){var e="";return void 0!==t.query&&(e+="query="+encodeURIComponent(t.query)),{indexName:t.indexName,params:s._getSearchParams(t.params,e)}})},u=o(a.requests,function(t,e){return e+"="+encodeURIComponent("/1/indexes/"+encodeURIComponent(t.indexName)+"?"+t.params)}).join("&"),c="/1/indexes/*/queries";return void 0!==e.strategy&&(c+="?strategy="+e.strategy),this._jsonRequest({cache:this.cache,method:"POST",url:c,body:a,hostType:"read",fallback:{method:"GET",url:"/1/indexes/*",body:{params:u}},callback:r})},u.prototype.searchForFacetValues=function(t){var e=n("49sm"),r=n("7Ule"),i="Usage: client.searchForFacetValues([{indexName, params: {facetName, facetQuery, ...params}}, ...queries])";if(!e(t))throw new Error(i);var o=this;return o._promise.all(r(t,function(t){if(!t||void 0===t.indexName||void 0===t.params.facetName||void 0===t.params.facetQuery)throw new Error(i);var e=n("sLmk"),r=n("PGxr"),s=t.indexName,a=t.params,u=a.facetName,c=r(e(a),function(t){return"facetName"===t}),l=o._getSearchParams(c,"");return o._jsonRequest({cache:o.cache,method:"POST",url:"/1/indexes/"+encodeURIComponent(s)+"/facets/"+encodeURIComponent(u)+"/query",hostType:"read",body:{params:l}})}))},u.prototype.setSecurityTags=function(t){if("[object Array]"===Object.prototype.toString.call(t)){for(var e=[],n=0;na?this._resetInitialAppIdData(t):t},u.prototype._resetInitialAppIdData=function(t){var e=t||{};return e.hostIndexes={read:0,write:0},e.timeoutMultiplier=1,e.shuffleResult=e.shuffleResult||function(t){var e,n,r=t.length;for(;0!==r;)n=Math.floor(Math.random()*r),e=t[r-=1],t[r]=t[n],t[n]=e;return t}([1,2,3]),this._setAppIdData(e)},u.prototype._cacheAppIdData=function(t){this._hostIndexes=t.hostIndexes,this._timeoutMultiplier=t.timeoutMultiplier,this._shuffleResult=t.shuffleResult},u.prototype._partialAppIdDataUpdate=function(t){var e=n("v61W"),r=this._getAppIdData();return e(t,function(t,e){r[e]=t}),this._setAppIdData(r)},u.prototype._getHostByType=function(t){return this.hosts[t][this._getHostIndexByType(t)]},u.prototype._getTimeoutMultiplier=function(){return this._timeoutMultiplier},u.prototype._getHostIndexByType=function(t){return this._hostIndexes[t]},u.prototype._setHostIndexByType=function(t,e){var r=n("sLmk")(this._hostIndexes);return r[e]=t,this._partialAppIdDataUpdate({hostIndexes:r}),t},u.prototype._incrementHostIndex=function(t){return this._setHostIndexByType((this._getHostIndexByType(t)+1)%this.hosts[t].length,t)},u.prototype._incrementTimeoutMultipler=function(){var t=Math.max(this._timeoutMultiplier+1,4);return this._partialAppIdDataUpdate({timeoutMultiplier:t})},u.prototype._getTimeoutsForRequest=function(t){return{connect:this._timeouts.connect*this._timeoutMultiplier,complete:this._timeouts[t]*this._timeoutMultiplier}}}).call(this,n("KCCg"))},"1KsK":function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=Object.prototype.toString;t.exports=function(t){var e=i.call(t),n="[object Arguments]"===e;return n||(n="[object Array]"!==e&&null!==t&&"object"===r(t)&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===i.call(t.callee)),n}},"1seS":function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,s=Array.prototype.slice,a=n("1KsK"),u=Object.prototype.propertyIsEnumerable,c=!u.call({toString:null},"toString"),l=u.call(function(){},"prototype"),h=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],p=function(t){var e=t.constructor;return e&&e.prototype===t},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!f["$"+t]&&i.call(window,t)&&null!==window[t]&&"object"===r(window[t]))try{p(window[t])}catch(t){return!0}}catch(t){return!0}return!1}(),m=function(t){var e=null!==t&&"object"===r(t),n="[object Function]"===o.call(t),s=a(t),u=e&&"[object String]"===o.call(t),f=[];if(!e&&!n&&!s)throw new TypeError("Object.keys called on a non-object");var m=l&&n;if(u&&t.length>0&&!i.call(t,0))for(var g=0;g0)for(var y=0;y=3&&n[1]>20&&((e=e||{}).additionalUA="autocomplete.js "+i),function(n,i){t.search(n,e,function(t,e){t?r.error(t.message):i(e.hits,e)})}}},"7kYT":function(t,e,n){"use strict";var r=Function.prototype.bind;t.exports=function(t){var e=function(){for(var e=arguments.length,n=Array(e),i=0;i'),this.$menu.append(this.$empty),this.$empty.hide()),this.datasets=r.map(t.datasets,function(e){return function(t,e,n){return new u.Dataset(r.mixin({$menu:t,cssClasses:n},e))}(s.$menu,e,t.cssClasses)}),r.each(this.datasets,function(t){var e=t.getRoot();e&&0===e.parent().length&&s.$menu.append(e),t.onSync("rendered",s._onRendered,s)}),t.templates&&t.templates.footer&&(this.templates.footer=r.templatify(t.templates.footer),this.$menu.append(this.templates.footer()));var l=this;i.element(window).resize(function(){l._redraw()})}r.mixin(u.prototype,o,{_onSuggestionClick:function(t){this.trigger("suggestionClicked",i.element(t.currentTarget))},_onSuggestionMouseEnter:function(t){var e=i.element(t.currentTarget);if(!e.hasClass(r.className(this.cssClasses.prefix,this.cssClasses.cursor,!0))){this._removeCursor();var n=this;setTimeout(function(){n._setCursor(e,!1)},0)}},_onSuggestionMouseLeave:function(t){if(t.relatedTarget&&i.element(t.relatedTarget).closest("."+r.className(this.cssClasses.prefix,this.cssClasses.cursor,!0)).length>0)return;this._removeCursor(),this.trigger("cursorRemoved")},_onRendered:function(t,e){if(this.isEmpty=r.every(this.datasets,function(t){return t.isEmpty()}),this.isEmpty)if(e.length>=this.minLength&&this.trigger("empty"),this.$empty)if(e.length=this.minLength?this._show():this._hide());this.trigger("datasetRendered")},_hide:function(){this.$container.hide()},_show:function(){this.$container.css("display","block"),this._redraw(),this.trigger("shown")},_redraw:function(){this.isOpen&&this.appendTo&&this.trigger("redrawn")},_getSuggestions:function(){return this.$menu.find(r.className(this.cssClasses.prefix,this.cssClasses.suggestion))},_getCursor:function(){return this.$menu.find(r.className(this.cssClasses.prefix,this.cssClasses.cursor)).first()},_setCursor:function(t,e){t.first().addClass(r.className(this.cssClasses.prefix,this.cssClasses.cursor,!0)).attr("aria-selected","true"),this.trigger("cursorMoved",e)},_removeCursor:function(){this._getCursor().removeClass(r.className(this.cssClasses.prefix,this.cssClasses.cursor,!0)).removeAttr("aria-selected")},_moveCursor:function(t){var e,n,r,i;this.isOpen&&(n=this._getCursor(),e=this._getSuggestions(),this._removeCursor(),-1!==(r=((r=e.index(n)+t)+1)%(e.length+1)-1)?(r<-1&&(r=e.length-1),this._setCursor(i=e.eq(r),!0),this._ensureVisible(i)):this.trigger("cursorRemoved"))},_ensureVisible:function(t){var e,n,r,i;n=(e=t.position().top)+t.height()+parseInt(t.css("margin-top"),10)+parseInt(t.css("margin-bottom"),10),r=this.$menu.scrollTop(),i=this.$menu.height()+parseInt(this.$menu.css("padding-top"),10)+parseInt(this.$menu.css("padding-bottom"),10),e<0?this.$menu.scrollTop(r+e):i0)return function(t){if((t=String(t)).length>100)return;var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(!e)return;var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*a;case"days":case"day":case"d":return n*s;case"hours":case"hour":case"hrs":case"hr":case"h":return n*o;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;case"seconds":case"second":case"secs":case"sec":case"s":return n*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(t);if("number"===c&&!1===isNaN(t))return e.long?function(t){return u(t,s,"day")||u(t,o,"hour")||u(t,i,"minute")||u(t,r,"second")||t+" ms"}(t):function(t){if(t>=s)return Math.round(t/s)+"d";if(t>=o)return Math.round(t/o)+"h";if(t>=i)return Math.round(t/i)+"m";if(t>=r)return Math.round(t/r)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},GlCl:function(t,e,n){"use strict";var r;r={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"};var i=n("jgMb"),o=n("BoXp"),s=n("1wyU");function a(t){var e,n,s,a,u=this;(t=t||{}).input||i.error("input is missing"),e=i.bind(this._onBlur,this),n=i.bind(this._onFocus,this),s=i.bind(this._onKeydown,this),a=i.bind(this._onInput,this),this.$hint=o.element(t.hint),this.$input=o.element(t.input).on("blur.aa",e).on("focus.aa",n).on("keydown.aa",s),0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=i.noop),i.isMsie()?this.$input.on("keydown.aa keypress.aa cut.aa paste.aa",function(t){r[t.which||t.keyCode]||i.defer(i.bind(u._onInput,u,t))}):this.$input.on("input.aa",a),this.query=this.$input.val(),this.$overflowHelper=function(t){return o.element('').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:t.css("font-family"),fontSize:t.css("font-size"),fontStyle:t.css("font-style"),fontVariant:t.css("font-variant"),fontWeight:t.css("font-weight"),wordSpacing:t.css("word-spacing"),letterSpacing:t.css("letter-spacing"),textIndent:t.css("text-indent"),textRendering:t.css("text-rendering"),textTransform:t.css("text-transform")}).insertAfter(t)}(this.$input)}function u(t){return t.altKey||t.ctrlKey||t.metaKey||t.shiftKey}a.normalizeQuery=function(t){return(t||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ")},i.mixin(a.prototype,s,{_onBlur:function(){this.resetInputValue(),this.$input.removeAttr("aria-activedescendant"),this.trigger("blurred")},_onFocus:function(){this.trigger("focused")},_onKeydown:function(t){var e=r[t.which||t.keyCode];this._managePreventDefault(e,t),e&&this._shouldTrigger(e,t)&&this.trigger(e+"Keyed",t)},_onInput:function(){this._checkInputValue()},_managePreventDefault:function(t,e){var n,r,i;switch(t){case"tab":r=this.getHint(),i=this.getInputValue(),n=r&&r!==i&&!u(e);break;case"up":case"down":n=!u(e);break;default:n=!1}n&&e.preventDefault()},_shouldTrigger:function(t,e){var n;switch(t){case"tab":n=!u(e);break;default:n=!0}return n},_checkInputValue:function(){var t,e,n;n=!(!(e=function(t,e){return a.normalizeQuery(t)===a.normalizeQuery(e)}(t=this.getInputValue(),this.query))||!this.query)&&this.query.length!==t.length,this.query=t,e?n&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},setQuery:function(t){this.query=t},getInputValue:function(){return this.$input.val()},setInputValue:function(t,e){void 0===t&&(t=this.query),this.$input.val(t),e?this.clearHint():this._checkInputValue()},expand:function(){this.$input.attr("aria-expanded","true")},collapse:function(){this.$input.attr("aria-expanded","false")},setActiveDescendant:function(t){this.$input.attr("aria-activedescendant",t)},removeActiveDescendant:function(){this.$input.removeAttr("aria-activedescendant")},resetInputValue:function(){this.setInputValue(this.query,!0)},getHint:function(){return this.$hint.val()},setHint:function(t){this.$hint.val(t)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var t,e,n;n=(t=this.getInputValue())!==(e=this.getHint())&&0===e.indexOf(t),""!==t&&n&&!this.hasOverflow()||this.clearHint()},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},hasOverflow:function(){var t=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=t},isCursorAtEnd:function(){var t,e,n;return t=this.$input.val().length,e=this.$input[0].selectionStart,i.isNumber(e)?e===t:!document.selection||((n=document.selection.createRange()).moveStart("character",-t),t===n.text.length)},destroy:function(){this.$hint.off(".aa"),this.$input.off(".aa"),this.$hint=this.$input=this.$overflowHelper=null}}),t.exports=a},JRE2:function(t,e){t.exports=function(t,e){return"algoliasearch: `"+t+"` was replaced by `"+e+"`. Please see https://github.com/algolia/algoliasearch-client-javascript/wiki/Deprecated#"+t.toLowerCase().replace(/[\.\(\)]/g,"")}},KCCg:function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],l=!1,h=-1;function p(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&f())}function f(){if(!l){var t=a(p);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h1)for(var n=1;n=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(o())}).call(this,n("KCCg"))},P5ON:function(t,e,n){"use strict";var r=n("vgmO"),i=r.Promise||n("E2g8").Promise;t.exports=function(t,e){var o=n("P7XM"),s=n("Z4lL"),a=n("bQm7"),u=n("+RWU"),c=n("5b/b");function l(t,e,r){return(r=n("sLmk")(r||{}))._ua=r._ua||l.ua,new p(t,e,r)}e=e||"",l.version=n("DiRl"),l.ua="Algolia for vanilla JavaScript "+e+l.version,l.initPlaces=c(l),r.__algolia={debug:n("NOtv"),algoliasearch:l};var h={hasXMLHttpRequest:"XMLHttpRequest"in r,hasXDomainRequest:"XDomainRequest"in r};function p(){t.apply(this,arguments)}return h.hasXMLHttpRequest&&(h.cors="withCredentials"in new XMLHttpRequest),o(p,t),p.prototype._request=function(t,e){return new i(function(n,r){if(h.cors||h.hasXDomainRequest){t=a(t,e.headers);var i,o,u=e.body,c=h.cors?new XMLHttpRequest:new XDomainRequest,l=!1;i=setTimeout(p,e.timeouts.connect),c.onprogress=function(){l||f()},"onreadystatechange"in c&&(c.onreadystatechange=function(){!l&&c.readyState>1&&f()}),c.onload=function(){if(o)return;var t;clearTimeout(i);try{t={body:JSON.parse(c.responseText),responseText:c.responseText,statusCode:c.status,headers:c.getAllResponseHeaders&&c.getAllResponseHeaders()||{}}}catch(e){t=new s.UnparsableJSON({more:c.responseText})}t instanceof s.UnparsableJSON?r(t):n(t)},c.onerror=function(t){if(o)return;clearTimeout(i),r(new s.Network({more:t}))},c instanceof XMLHttpRequest?(c.open(e.method,t,!0),e.forceAuthHeaders&&(c.setRequestHeader("x-algolia-application-id",e.headers["x-algolia-application-id"]),c.setRequestHeader("x-algolia-api-key",e.headers["x-algolia-api-key"]))):c.open(e.method,t),h.cors&&(u&&("POST"===e.method?c.setRequestHeader("content-type","application/x-www-form-urlencoded"):c.setRequestHeader("content-type","application/json")),c.setRequestHeader("accept","application/json")),u?c.send(u):c.send()}else r(new s.Network("CORS not supported"));function p(){o=!0,c.abort(),r(new s.RequestTimeout)}function f(){l=!0,clearTimeout(i),i=setTimeout(p,e.timeouts.complete)}})},p.prototype._request.fallback=function(t,e){return t=a(t,e.headers),new i(function(n,r){u(t,e,function(t,e){t?r(t):n(e)})})},p.prototype._promise={reject:function(t){return i.reject(t)},resolve:function(t){return i.resolve(t)},delay:function(t){return new i(function(e){setTimeout(e,t)})},all:function(t){return i.all(t)}},l}},P7XM:function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},PGxr:function(t,e,n){t.exports=function(t,e){var r=n("1seS"),i={};return n("v61W")(r(t),function(n){!0!==e(n)&&(i[n]=t[n])}),i}},PKsF:function(t,e,n){!function(t){var e=/\S/,n=/\"/g,r=/\n/g,i=/\r/g,o=/\\/g,s=/\u2028/,a=/\u2029/;function u(t){"}"===t.n.substr(t.n.length-1)&&(t.n=t.n.substring(0,t.n.length-1))}function c(t){return t.trim?t.trim():t.replace(/^\s*|\s*$/g,"")}function l(t,e,n){if(e.charAt(n)!=t.charAt(0))return!1;for(var r=1,i=t.length;r":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(n,r){var i=n.length,o=0,s=null,a=null,h="",p=[],f=!1,d=0,m=0,g="{{",y="}}";function v(){h.length>0&&(p.push({tag:"_t",text:new String(h)}),h="")}function b(n,r){if(v(),n&&function(){for(var n=!0,r=m;r"==i.tag&&(i.indent=p[o].text.toString()),p.splice(o,1));else r||p.push({tag:"\n"});f=!1,m=p.length}function w(t,e){var n="="+y,r=t.indexOf(n,e),i=c(t.substring(t.indexOf("=",e)+1,r)).split(" ");return g=i[0],y=i[i.length-1],r+n.length-1}for(r&&(r=r.split(" "),g=r[0],y=r[1]),d=0;d":v,"<":function(e,n){var r={partials:{},code:"",subs:{},inPartial:!0};t.walk(e.nodes,r);var i=n.partials[v(e,n)];i.subs=r.subs,i.partials=r.partials},$:function(e,n){var r={subs:{},code:"",partials:n.partials,prefix:e.n};t.walk(e.nodes,r),n.subs[e.n]=r.code,n.inPartial||(n.code+='t.sub("'+g(e.n)+'",c,p,i);')},"\n":function(t,e){e.code+=w('"\\n"'+(t.last?"":" + i"))},_v:function(t,e){e.code+="t.b(t.v(t."+y(t.n)+'("'+g(t.n)+'",c,p,0)));'},_t:function(t,e){e.code+=w('"'+g(t.text)+'"')},"{":b,"&":b},t.walk=function(e,n){for(var r,i=0,o=e.length;i0;){if(c=n.shift(),s&&"<"==s.tag&&!(c.tag in h))throw new Error("Illegal content in < super tag.");if(t.tags[c.tag]<=t.tags.$||p(c,o))i.push(c),c.nodes=e(n,c.tag,i,o);else{if("/"==c.tag){if(0===i.length)throw new Error("Closing tag without opener: /"+c.n);if(u=i.pop(),c.n!=u.n&&!f(c.n,u.n,o))throw new Error("Nesting error: "+u.n+" vs. "+c.n);return u.end=c.i,a}"\n"==c.tag&&(c.last=0==n.length||"\n"==n[0].tag)}a.push(c)}if(i.length>0)throw new Error("missing closing tag: "+i.pop().n);return a}(e,0,[],(r=r||{}).sectionTags||[])},t.cache={},t.cacheKey=function(t,e){return[t,!!e.asString,!!e.disableLambda,e.delimiters,!!e.modelGet].join("||")},t.compile=function(e,n){n=n||{};var r=t.cacheKey(e,n),i=this.cache[r];if(i){var o=i.partials;for(var s in o)delete o[s].instance;return i}return i=this.generate(this.parse(this.scan(e,n.delimiters),e,n),e,n),this.cache[r]=i}}(e)},Ruv9:function(t,e,n){var r=n("PKsF");r.Template=n("cK6b").Template,r.template=r.Template,t.exports=r},"UjO/":function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t:{default:t}}(n("YQXE"));t.exports=r.default},X9Cu:function(t,e,n){"use strict";t.exports=function(t){var e=t.match(/Algolia for vanilla JavaScript (\d+\.)(\d+\.)(\d+)/);if(e)return[e[1],e[2],e[3]]}},YQXE:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=s(n("7kYT")),i=s(n("cq35")),o=s(n("+Ewk"));function s(t){return t&&t.__esModule?t:{default:t}}var a=(0,r.default)(i.default);a.version=o.default,e.default=a},Z4lL:function(t,e,n){"use strict";var r=n("P7XM");function i(t,e){var r=n("v61W"),i=this;"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):i.stack=(new Error).stack||"Cannot get a stacktrace, browser is too old",this.name="AlgoliaSearchError",this.message=t||"Unknown error",e&&r(e,function(t,e){i[e]=t})}function o(t,e){function n(){var n=Array.prototype.slice.call(arguments,0);"string"!=typeof n[0]&&n.unshift(e),i.apply(this,n),this.name="AlgoliaSearch"+t+"Error"}return r(n,i),n}r(i,Error),t.exports={AlgoliaSearchError:i,UnparsableJSON:o("UnparsableJSON","Could not parse the incoming response as JSON, see err.more for details"),RequestTimeout:o("RequestTimeout","Request timedout before getting a response"),Network:o("Network","Network issue, see err.more for details"),JSONPScriptFail:o("JSONPScriptFail"," - - - - - - - -
- -
- -
-
-
-
-

Async Changelog

- - - -

- - 2024 -

- - -

- - - 4.3.0 - - - (2024-06-04) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve performance by avoiding unneeded references in FiberMap.
    -(#88 by @clue)

    -
  • -
  • -

    Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
    -(#87 by @clue)

    -
  • -
  • -

    Improve type safety for test environment.
    -(#86 by @SimonFrings)

    -
  • -
- -
-

- - 2023 -

- - -

- - - 4.2.0 - - - (2023-11-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add Promise v3 template types for all public functions.
    -(#40 by @WyriHaximus and @clue)

    -

    All our public APIs now use Promise v3 template types to guide IDEs and static
    -analysis tools (like PHPStan), helping with proper type usage and improving
    -code quality:

    -
    assertType('bool', await(resolve(true)));
    -assertType('PromiseInterface<bool>', async(fn(): bool => true)());
    -assertType('PromiseInterface<bool>', coroutine(fn(): bool => true));
    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#81 by @clue)

    -
  • -
  • -

    Update test suite to avoid unhandled promise rejections.
    -(#79 by @clue)

    -
  • -
- -
- -

- - - 3.2.0 - - - (2023-11-22) - - Release on GitHub - - -

- -

This release contains backported features from the Async v4.2.0 release for those
-not yet on PHP 8.1+. Async v3 provides a compatible API, but may not take advantage
-of newer language features. We encourage upgrading to the latest version when possible.

-
    -
  • -

    Feature: Add Promise v3 template types for all public functions.
    -(#82 by @WyriHaximus and @clue)

    -

    All our public APIs now use Promise v3 template types to guide IDEs and static
    -analysis tools (like PHPStan), helping with proper type usage and improving
    -code quality:

    -
    assertType('bool', await(resolve(true)));
    -assertType('PromiseInterface<bool>', coroutine(fn(): bool => true));
    -
  • -
  • -

    Feature: Full PHP 8.3 compatibility.
    -(#83 by @clue)

    -
  • -
  • -

    Update test suite to avoid unhandled promise rejections.
    -(#80 by @clue)

    -
  • -
- -
- -

- - - 2.2.0 - - - (2023-11-22) - - Release on GitHub - - -

- -

This is a compatibility release to ensure a smooth upgrade path for those not yet
-on Async v4 or v3. We encourage upgrading to the latest version when possible, as
-Async v4 will be the way forward for this project.

-
    -
  • Feature: Full PHP 8.3 compatibility.
    -(#84 by @clue)
  • -
- -
- -

- - - 4.1.0 - - - (2023-06-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new delay() function to delay program execution.
    -(#69 and #78 by @clue)

    -
    echo 'a';
    -Loop::addTimer(1.0, function () {
    -    echo 'b';
    -});
    -React\Async\delay(3.0);
    -echo 'c';
    -
    -// prints "a" at t=0.0s
    -// prints "b" at t=1.0s
    -// prints "c" at t=3.0s
    -
  • -
  • -

    Update test suite, add PHPStan with max level and report failed assertions.
    -(#66 and #76 by @clue and #61 and #73 by @WyriHaximus)

    -
  • -
- -
- -

- - - 3.1.0 - - - (2023-06-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new delay() function to delay program execution.
    -(#71 by @clue)

    -
    echo 'a';
    -Loop::addTimer(1.0, function () {
    -    echo 'b';
    -});
    -React\Async\delay(3.0);
    -echo 'c';
    -
    -// prints "a" at t=0.0s
    -// prints "b" at t=1.0s
    -// prints "c" at t=3.0s
    -
  • -
  • -

    Update test suite, add PHPStan with max level and report failed assertions.
    -(#67 and #77 by @clue and #60 and #74 by @WyriHaximus)

    -
  • -
- -
- -

- - - 2.1.0 - - - (2023-06-22) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Add new delay() function to delay program execution.
    -(#72 by @clue)

    -
    echo 'a';
    -Loop::addTimer(1.0, function () {
    -    echo 'b';
    -});
    -React\Async\delay(3.0);
    -echo 'c';
    -
    -// prints "a" at t=0.0s
    -// prints "b" at t=1.0s
    -// prints "c" at t=3.0s
    -
  • -
  • -

    Update test suite, run tests on PHP 8.2 and report failed assertions.
    -(#59 and #75 by @WyriHaximus and #68 by @clue)

    -
  • -
- -
-

- - 2022 -

- - -

- - - 4.0.0 - - - (2022-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    We'd like to emphasize that this component is production ready and battle-tested.
    -We plan to support all long-term support (LTS) releases for at least 24 months,
    -so you have a rock-solid foundation to build on top of.

    -
  • -
  • -

    The v4 release will be the way forward for this package. However, we will still
    -actively support v3 and v2 to provide a smooth upgrade path for those not yet
    -on PHP 8.1+. If you're using an older PHP version, you may use either version
    -which all provide a compatible API but may not take advantage of newer language
    -features. You may target multiple versions at the same time to support a wider range of
    -PHP versions:

    - -
  • -
-

This update involves some major new features and a minor BC break over the
-v3.0.0 release. We've tried hard to avoid BC breaks where possible and
-minimize impact otherwise. We expect that most consumers of this package will be
-affected by BC breaks, but updating should take no longer than a few minutes.
-See below for more details:

-
    -
  • -

    Feature / BC break: Require PHP 8.1+ and add mixed type declarations.
    -(#14 by @clue)

    -
  • -
  • -

    Feature: Add Fiber-based async() and await() functions.
    -(#15, #18, #19 and #20 by @WyriHaximus and #26, #28, #30, #32, #34, #55 and #57 by @clue)

    -
  • -
  • -

    Project maintenance, rename main branch to 4.x and update installation instructions.
    -(#29 by @clue)

    -
  • -
-

The following changes had to be ported to this release due to our branching
-strategy, but also appeared in the v3.0.0 release:

-
    -
  • -

    Feature: Support iterable type for parallel() + series() + waterfall().
    -(#49 by @clue)

    -
  • -
  • -

    Feature: Forward compatibility with upcoming Promise v3.
    -(#48 by @clue)

    -
  • -
  • -

    Minor documentation improvements.
    -(#36 by @SimonFrings and #51 by @nhedger)

    -
  • -
- -
- -

- - - 3.0.0 - - - (2022-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    We'd like to emphasize that this component is production ready and battle-tested.
    -We plan to support all long-term support (LTS) releases for at least 24 months,
    -so you have a rock-solid foundation to build on top of.

    -
  • -
  • -

    The v4 release will be the way forward for this package. However, we will still
    -actively support v3 and v2 to provide a smooth upgrade path for those not yet
    -on PHP 8.1+. If you're using an older PHP version, you may use either version
    -which all provide a compatible API but may not take advantage of newer language
    -features. You may target multiple versions at the same time to support a wider range of
    -PHP versions:

    - -
  • -
-

This update involves some major new features and a minor BC break over the
-v2.0.0 release. We've tried hard to avoid BC breaks where possible and
-minimize impact otherwise. We expect that most consumers of this package will be
-affected by BC breaks, but updating should take no longer than a few minutes.
-See below for more details:

-
    -
  • -

    Feature / BC break: Require PHP 7.1+ and add type declarations.
    -(#11 by @clue)

    -
  • -
  • -

    Feature: Add Generator-based coroutine() function.
    -(#12, #13 and #54 by @clue)

    -
  • -
  • -

    Feature: Support iterable type for parallel() + series() + waterfall().
    -(#45 by @clue)

    -
  • -
-

The following changes had to be ported to this release due to our branching
-strategy, but also appeared in the v2.0.0 release:

-
    -
  • -

    Feature: Only stop loop for await() if a pending promise resolves/rejects.
    -(#33 by @SimonFrings)

    -
  • -
  • -

    Feature: Forward compatibility with upcoming Promise v3.
    -(#47 by @clue)

    -
  • -
  • -

    Minor documentation improvements.
    -(#37 by @SimonFrings and #52 by @nhedger)

    -
  • -
- -
- -

- - - 2.0.0 - - - (2022-07-11) - - Release on GitHub - - -

- -

A major new feature release, see release announcement.

-
    -
  • -

    We'd like to emphasize that this component is production ready and battle-tested.
    -We plan to support all long-term support (LTS) releases for at least 24 months,
    -so you have a rock-solid foundation to build on top of.

    -
  • -
  • -

    The v4 release will be the way forward for this package. However, we will still
    -actively support v3 and v2 to provide a smooth upgrade path for those not yet
    -on PHP 8.1+. If you're using an older PHP version, you may use either version
    -which all provide a compatible API but may not take advantage of newer language
    -features. You may target multiple versions at the same time to support a wider range of
    -PHP versions:

    - -
  • -
-

This update involves some major changes over the previous v1.0.0 release that
-has been deprecated since 2013. Accordingly, most consumers of this package
-should not be affected by any BC breaks. See below for more details:

-
    -
  • -

    Feature / BC break: Change to Promise-based APIs instead of callbacks (continuation-passing style).
    -Support promise cancellation and upcoming Promise v3.
    -(#6, #7, #9 and #46 by @clue)

    -
  • -
  • -

    Feature: Add new await() function (import from clue/reactphp-block).
    -(#8 by @clue and #39 by @SimonFrings)

    -
  • -
  • -

    Minor documentation improvements.
    -(#38 by @SimonFrings and #53 by @nhedger)

    -
  • -
  • -

    Improve test suite and add .gitattributes to exclude dev files from exports.
    -Run tests on PHP 8.1, PHPUnit 9, switch to GitHub actions and clean up test suite.
    -(#2, #3, #4, #5 and #10 by @clue)

    -
  • -
- -
-

- - 2013 -

- - -

- - - 1.0.0 - - - (2013-02-06) - - Release on GitHub - - -

- -
-

Imported release from original tag date 2013-02-06.

-
-
    -
  • First tagged release
  • -
- -
- - -
- -
-
-
- - - - diff --git a/async/index.html b/async/index.html deleted file mode 100644 index 613a1aaa1..000000000 --- a/async/index.html +++ /dev/null @@ -1,932 +0,0 @@ - - - - - - - - Async: Async Utilities - ReactPHP - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-

Async

- -

Async Utilities

-

CI status -installs on Packagist

-

Async utilities and fibers for ReactPHP.

-

This library allows you to manage async control flow. It provides a number of -combinators for Promise-based APIs. -Instead of nesting or chaining promise callbacks, you can declare them as a -list, which is resolved sequentially in an async manner. -React/Async will not automagically change blocking code to be async. You need -to have an actual event loop and non-blocking libraries interacting with that -event loop for it to work. As long as you have a Promise-based API that runs in -an event loop, it can be used with this library.

-

Table of Contents

- -

Usage

-

This lightweight library consists only of a few simple functions. -All functions reside under the React\Async namespace.

-

The below examples refer to all functions with their fully-qualified names like this:

-
React\Async\await(…);
-

As of PHP 5.6+ you can also import each required function into your code like this:

-
use function React\Async\await;
-
-await(…);
-

Alternatively, you can also use an import statement similar to this:

-
use React\Async;
-
-Async\await(…);
-

async()

-

The async(callable():(PromiseInterface<T>|T) $function): (callable():PromiseInterface<T>) function can be used to -return an async function for a function that uses await() internally.

-

This function is specifically designed to complement the await() function. -The await() function can be considered blocking from the -perspective of the calling code. You can avoid this blocking behavior by -wrapping it in an async() function call. Everything inside this function -will still be blocked, but everything outside this function can be executed -asynchronously without blocking:

-
Loop::addTimer(0.5, React\Async\async(function () {
-    echo 'a';
-    React\Async\await(React\Promise\Timer\sleep(1.0));
-    echo 'c';
-}));
-
-Loop::addTimer(1.0, function () {
-    echo 'b';
-});
-
-// prints "a" at t=0.5s
-// prints "b" at t=1.0s
-// prints "c" at t=1.5s
-

See also the await() function for more details.

-

Note that this function only works in tandem with the await() function. -In particular, this function does not "magically" make any blocking function -non-blocking:

-
Loop::addTimer(0.5, React\Async\async(function () {
-    echo 'a';
-    sleep(1); // broken: using PHP's blocking sleep() for demonstration purposes
-    echo 'c';
-}));
-
-Loop::addTimer(1.0, function () {
-    echo 'b';
-});
-
-// prints "a" at t=0.5s
-// prints "c" at t=1.5s: Correct timing, but wrong order
-// prints "b" at t=1.5s: Triggered too late because it was blocked
-

As an alternative, you should always make sure to use this function in tandem -with the await() function and an async API returning a promise -as shown in the previous example.

-

The async() function is specifically designed for cases where it is used -as a callback (such as an event loop timer, event listener, or promise -callback). For this reason, it returns a new function wrapping the given -$function instead of directly invoking it and returning its value.

-
use function React\Async\async;
-
-Loop::addTimer(1.0, async(function () { … }));
-$connection->on('close', async(function () { … }));
-$stream->on('data', async(function ($data) { … }));
-$promise->then(async(function (int $result) { … }));
-

You can invoke this wrapping function to invoke the given $function with -any arguments given as-is. The function will always return a Promise which -will be fulfilled with whatever your $function returns. Likewise, it will -return a promise that will be rejected if you throw an Exception or -Throwable from your $function. This allows you to easily create -Promise-based functions:

-
$promise = React\Async\async(function (): int {
-    $browser = new React\Http\Browser();
-    $urls = [
-        'https://example.com/alice',
-        'https://example.com/bob'
-    ];
-
-    $bytes = 0;
-    foreach ($urls as $url) {
-        $response = React\Async\await($browser->get($url));
-        assert($response instanceof Psr\Http\Message\ResponseInterface);
-        $bytes += $response->getBody()->getSize();
-    }
-    return $bytes;
-})();
-
-$promise->then(function (int $bytes) {
-    echo 'Total size: ' . $bytes . PHP_EOL;
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

The previous example uses await() inside a loop to highlight how -this vastly simplifies consuming asynchronous operations. At the same time, -this naive example does not leverage concurrent execution, as it will -essentially "await" between each operation. In order to take advantage of -concurrent execution within the given $function, you can "await" multiple -promises by using a single await() together with Promise-based -primitives like this:

-
$promise = React\Async\async(function (): int {
-    $browser = new React\Http\Browser();
-    $urls = [
-        'https://example.com/alice',
-        'https://example.com/bob'
-    ];
-
-    $promises = [];
-    foreach ($urls as $url) {
-        $promises[] = $browser->get($url);
-    }
-
-    try {
-        $responses = React\Async\await(React\Promise\all($promises));
-    } catch (Exception $e) {
-        foreach ($promises as $promise) {
-            $promise->cancel();
-        }
-        throw $e;
-    }
-
-    $bytes = 0;
-    foreach ($responses as $response) {
-        assert($response instanceof Psr\Http\Message\ResponseInterface);
-        $bytes += $response->getBody()->getSize();
-    }
-    return $bytes;
-})();
-
-$promise->then(function (int $bytes) {
-    echo 'Total size: ' . $bytes . PHP_EOL;
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

The returned promise is implemented in such a way that it can be cancelled -when it is still pending. Cancelling a pending promise will cancel any awaited -promises inside that fiber or any nested fibers. As such, the following example -will only output ab and cancel the pending delay(). -The await() calls in this example would throw a RuntimeException -from the cancelled delay() call that bubbles up through the fibers.

-
$promise = async(static function (): int {
-    echo 'a';
-    await(async(static function (): void {
-        echo 'b';
-        delay(2);
-        echo 'c';
-    })());
-    echo 'd';
-
-    return time();
-})();
-
-$promise->cancel();
-await($promise);
-

await()

-

The await(PromiseInterface<T> $promise): T function can be used to -block waiting for the given $promise to be fulfilled.

-
$result = React\Async\await($promise);
-

This function will only return after the given $promise has settled, i.e. -either fulfilled or rejected. While the promise is pending, this function -can be considered blocking from the perspective of the calling code. -You can avoid this blocking behavior by wrapping it in an async() function -call. Everything inside this function will still be blocked, but everything -outside this function can be executed asynchronously without blocking:

-
Loop::addTimer(0.5, React\Async\async(function () {
-    echo 'a';
-    React\Async\await(React\Promise\Timer\sleep(1.0));
-    echo 'c';
-}));
-
-Loop::addTimer(1.0, function () {
-    echo 'b';
-});
-
-// prints "a" at t=0.5s
-// prints "b" at t=1.0s
-// prints "c" at t=1.5s
-

See also the async() function for more details.

-

Once the promise is fulfilled, this function will return whatever the promise -resolved to.

-

Once the promise is rejected, this will throw whatever the promise rejected -with. If the promise did not reject with an Exception or Throwable, then -this function will throw an UnexpectedValueException instead.

-
try {
-    $result = React\Async\await($promise);
-    // promise successfully fulfilled with $result
-    echo 'Result: ' . $result;
-} catch (Throwable $e) {
-    // promise rejected with $e
-    echo 'Error: ' . $e->getMessage();
-}
-

coroutine()

-

The coroutine(callable(mixed ...$args):(\Generator|PromiseInterface<T>|T) $function, mixed ...$args): PromiseInterface<T> function can be used to -execute a Generator-based coroutine to "await" promises.

-
React\Async\coroutine(function () {
-    $browser = new React\Http\Browser();
-
-    try {
-        $response = yield $browser->get('https://example.com/');
-        assert($response instanceof Psr\Http\Message\ResponseInterface);
-        echo $response->getBody();
-    } catch (Exception $e) {
-        echo 'Error: ' . $e->getMessage() . PHP_EOL;
-    }
-});
-

Using Generator-based coroutines is an alternative to directly using the -underlying promise APIs. For many use cases, this makes using promise-based -APIs much simpler, as it resembles a synchronous code flow more closely. -The above example performs the equivalent of directly using the promise APIs:

-
$browser = new React\Http\Browser();
-
-$browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseInterface $response) {
-    echo $response->getBody();
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

The yield keyword can be used to "await" a promise resolution. Internally, -it will turn the entire given $function into a Generator. -This allows the execution to be interrupted and resumed at the same place -when the promise is fulfilled. The yield statement returns whatever the -promise is fulfilled with. If the promise is rejected, it will throw an -Exception or Throwable.

-

The coroutine() function will always return a Promise which will be -fulfilled with whatever your $function returns. Likewise, it will return -a promise that will be rejected if you throw an Exception or Throwable -from your $function. This allows you to easily create Promise-based -functions:

-
$promise = React\Async\coroutine(function () {
-    $browser = new React\Http\Browser();
-    $urls = [
-        'https://example.com/alice',
-        'https://example.com/bob'
-    ];
-
-    $bytes = 0;
-    foreach ($urls as $url) {
-        $response = yield $browser->get($url);
-        assert($response instanceof Psr\Http\Message\ResponseInterface);
-        $bytes += $response->getBody()->getSize();
-    }
-    return $bytes;
-});
-
-$promise->then(function (int $bytes) {
-    echo 'Total size: ' . $bytes . PHP_EOL;
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

The previous example uses a yield statement inside a loop to highlight how -this vastly simplifies consuming asynchronous operations. At the same time, -this naive example does not leverage concurrent execution, as it will -essentially "await" between each operation. In order to take advantage of -concurrent execution within the given $function, you can "await" multiple -promises by using a single yield together with Promise-based primitives -like this:

-
$promise = React\Async\coroutine(function () {
-    $browser = new React\Http\Browser();
-    $urls = [
-        'https://example.com/alice',
-        'https://example.com/bob'
-    ];
-
-    $promises = [];
-    foreach ($urls as $url) {
-        $promises[] = $browser->get($url);
-    }
-
-    try {
-        $responses = yield React\Promise\all($promises);
-    } catch (Exception $e) {
-        foreach ($promises as $promise) {
-            $promise->cancel();
-        }
-        throw $e;
-    }
-
-    $bytes = 0;
-    foreach ($responses as $response) {
-        assert($response instanceof Psr\Http\Message\ResponseInterface);
-        $bytes += $response->getBody()->getSize();
-    }
-    return $bytes;
-});
-
-$promise->then(function (int $bytes) {
-    echo 'Total size: ' . $bytes . PHP_EOL;
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

delay()

-

The delay(float $seconds): void function can be used to -delay program execution for duration given in $seconds.

-
React\Async\delay($seconds);
-

This function will only return after the given number of $seconds have -elapsed. If there are no other events attached to this loop, it will behave -similar to PHP's sleep() function.

-
echo 'a';
-React\Async\delay(1.0);
-echo 'b';
-
-// prints "a" at t=0.0s
-// prints "b" at t=1.0s
-

Unlike PHP's sleep() function, -this function may not necessarily halt execution of the entire process thread. -Instead, it allows the event loop to run any other events attached to the -same loop until the delay returns:

-
echo 'a';
-Loop::addTimer(1.0, function (): void {
-    echo 'b';
-});
-React\Async\delay(3.0);
-echo 'c';
-
-// prints "a" at t=0.0s
-// prints "b" at t=1.0s
-// prints "c" at t=3.0s
-

This behavior is especially useful if you want to delay the program execution -of a particular routine, such as when building a simple polling or retry -mechanism:

-
try {
-    something();
-} catch (Throwable) {
-    // in case of error, retry after a short delay
-    React\Async\delay(1.0);
-    something();
-}
-

Because this function only returns after some time has passed, it can be -considered blocking from the perspective of the calling code. You can avoid -this blocking behavior by wrapping it in an async() function call. -Everything inside this function will still be blocked, but everything outside -this function can be executed asynchronously without blocking:

-
Loop::addTimer(0.5, React\Async\async(function (): void {
-    echo 'a';
-    React\Async\delay(1.0);
-    echo 'c';
-}));
-
-Loop::addTimer(1.0, function (): void {
-    echo 'b';
-});
-
-// prints "a" at t=0.5s
-// prints "b" at t=1.0s
-// prints "c" at t=1.5s
-

See also the async() function for more details.

-

Internally, the $seconds argument will be used as a timer for the loop so that -it keeps running until this timer triggers. This implies that if you pass a -really small (or negative) value, it will still start a timer and will thus -trigger at the earliest possible time in the future.

-

The function is implemented in such a way that it can be cancelled when it is -running inside an async() function. Cancelling the resulting -promise will clean up any pending timers and throw a RuntimeException from -the pending delay which in turn would reject the resulting promise.

-
$promise = async(function (): void {
-    echo 'a';
-    delay(3.0);
-    echo 'b';
-})();
-
-Loop::addTimer(2.0, function () use ($promise): void {
-    $promise->cancel();
-});
-
-// prints "a" at t=0.0s
-// rejects $promise at t=2.0
-// never prints "b"
-

parallel()

-

The parallel(iterable<callable():PromiseInterface<T>> $tasks): PromiseInterface<array<T>> function can be used -like this:

-
<?php
-
-use React\EventLoop\Loop;
-use React\Promise\Promise;
-
-React\Async\parallel([
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for a whole second');
-            });
-        });
-    },
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for another whole second');
-            });
-        });
-    },
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for yet another whole second');
-            });
-        });
-    },
-])->then(function (array $results) {
-    foreach ($results as $result) {
-        var_dump($result);
-    }
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

series()

-

The series(iterable<callable():PromiseInterface<T>> $tasks): PromiseInterface<array<T>> function can be used -like this:

-
<?php
-
-use React\EventLoop\Loop;
-use React\Promise\Promise;
-
-React\Async\series([
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for a whole second');
-            });
-        });
-    },
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for another whole second');
-            });
-        });
-    },
-    function () {
-        return new Promise(function ($resolve) {
-            Loop::addTimer(1, function () use ($resolve) {
-                $resolve('Slept for yet another whole second');
-            });
-        });
-    },
-])->then(function (array $results) {
-    foreach ($results as $result) {
-        var_dump($result);
-    }
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

waterfall()

-

The waterfall(iterable<callable(mixed=):PromiseInterface<T>> $tasks): PromiseInterface<T> function can be used -like this:

-
<?php
-
-use React\EventLoop\Loop;
-use React\Promise\Promise;
-
-$addOne = function ($prev = 0) {
-    return new Promise(function ($resolve) use ($prev) {
-        Loop::addTimer(1, function () use ($prev, $resolve) {
-            $resolve($prev + 1);
-        });
-    });
-};
-
-React\Async\waterfall([
-    $addOne,
-    $addOne,
-    $addOne
-])->then(function ($prev) {
-    echo "Final result is $prev\n";
-}, function (Exception $e) {
-    echo 'Error: ' . $e->getMessage() . PHP_EOL;
-});
-

Todo

-
    -
  • Implement queue()
  • -
-

Install

-

The recommended way to install this library is through Composer. -New to Composer?

-

This project follows SemVer. -This will install the latest supported version from this branch:

-
composer require react/async:^4.3
-

See also the CHANGELOG for details about version upgrades.

-

This project aims to run on any platform and thus does not require any PHP -extensions and supports running on PHP 8.1+. -It's highly recommended to use the latest supported PHP version for this project.

-

We're committed to providing long-term support (LTS) options and to provide a -smooth upgrade path. If you're using an older PHP version, you may use the -3.x branch (PHP 7.1+) or -2.x branch (PHP 5.3+) which both -provide a compatible API but do not take advantage of newer language features. -You may target multiple versions at the same time to support a wider range of -PHP versions like this:

-
composer require "react/async:^4 || ^3 || ^2"
-

Tests

-

To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

-
composer install
-

To run the test suite, go to the project root and run:

-
vendor/bin/phpunit
-

On top of this, we use PHPStan on max level to ensure type safety across the project:

-
vendor/bin/phpstan
-

License

-

MIT, see LICENSE file.

-

This project is heavily influenced by async.js.

-
- -
-
-
- - - - diff --git a/async/license.html b/async/license.html deleted file mode 100644 index ba50c60fd..000000000 --- a/async/license.html +++ /dev/null @@ -1,420 +0,0 @@ - - - - - - - - Async: License - ReactPHP - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-
-
-

Async License

- -

Copyright (c) 2012 Christian Lück, Cees-Jan Kiewiet, Jan Sorgalla, Chris Boden, Igor Wiedler

-

Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions:

-

The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software.

-

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE.

-
- -
-
-
- - - - diff --git a/cache/changelog.html b/cache/changelog.html index 14f226e64..90a5aaae2 100644 --- a/cache/changelog.html +++ b/cache/changelog.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -41,7 +41,7 @@
-
- + + + -

- - - Socket 1.2.0 - - - (2019-01-07) - - Release on GitHub - - -

- -
    -
  • -

    Feature / Fix: Improve TLS 1.3 support.
    -(#186 by @clue)

    -

    TLS 1.3 is now an official standard as of August 2018! 🎉
    -The protocol has major improvements in the areas of security, performance, and privacy.
    -TLS 1.3 is supported by default as of OpenSSL 1.1.1.
    -For example, this version ships with Ubuntu 18.10 (and newer) by default, meaning that recent installations support TLS 1.3 out of the box :shipit:

    -
  • -
  • -

    Fix: Avoid possibility of missing remote address when TLS handshake fails.
    -(#188 by @clue)

    -
  • -
  • -

    Improve performance by prefixing all global functions calls with \ to skip the look up and resolve process and go straight to the global function.
    -(#183 by @WyriHaximus)

    -
  • -
  • -

    Update documentation to use full class names with namespaces.
    -(#187 by @clue)

    -
  • -
  • -

    Improve test suite to avoid some possible race conditions,
    -test against PHP 7.3 on Travis and
    -use dedicated assertInstanceOf() assertions.
    -(#185 by @clue, #178 by @WyriHaximus and #181 by @carusogabriel)

    -
  • -
- -
-

- - - Stream 1.1.0 +
+
+

+Changelog

+

The combined changelog for all ReactPHP components.

- - (2019-01-01) - - Release on GitHub - - -

- + -
-

+

2018

-

- - - DNS 0.4.16 - - - (2018-11-11) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve promise cancellation for DNS lookup retries and clean up any garbage references.
    -(#118 by @clue)

    -
  • -
  • -

    Fix: Reject parsing malformed DNS response messages such as incomplete DNS response messages,
    -malformed record data or malformed compressed domain name labels.
    -(#115 and #117 by @clue)

    -
  • -
  • -

    Fix: Fix interpretation of TTL as UINT32 with most significant bit unset.
    -(#116 by @clue)

    -
  • -
  • -

    Fix: Fix caching advanced MX/SRV/TXT/SOA structures.
    -(#112 by @clue)

    -
  • -
- -
- -

- - - Socket 1.1.0 - - - (2018-10-01) - - Release on GitHub - - -

- -
    -
  • -

    Feature: Improve error reporting for failed connection attempts and improve
    -cancellation forwarding during DNS lookup, TCP/IP connection or TLS handshake.
    -(#168, #169, #170, #171, #176 and #177 by @clue)

    -

    All error messages now always contain a reference to the remote URI to give
    -more details which connection actually failed and the reason for this error.
    -Accordingly, failures during DNS lookup will now mention both the remote URI
    -as well as the DNS error reason. TCP/IP connection issues and errors during
    -a secure TLS handshake will both mention the remote URI as well as the
    -underlying socket error. Similarly, lost/dropped connections during a TLS
    -handshake will now report a lost connection instead of an empty error reason.

    -

    For most common use cases this means that simply reporting the Exception
    -message should give the most relevant details for any connection issues:

    -
    $promise = $connector->connect('tls://example.com:443');
    -$promise->then(function (ConnectionInterface $conn) use ($loop) {
    -    // …
    -}, function (Exception $e) {
    -    echo $e->getMessage();
    -});
    -
  • -
- -
-

@@ -4491,14 +233,14 @@

-
    +
    • First stable LTS release, now following SemVer.
      We'd like to emphasize that this component is production ready and battle-tested.
      We plan to support all long-term support (LTS) releases for at least 24 months,
      so you have a rock-solid foundation to build on top of.
    -

    Contains no other changes, so it's actually fully compatible with the v0.8.12 release.

    +

    Contains no other changes, so it's actually fully compatible with the v0.8.12 release.


    @@ -4516,14 +258,14 @@

    -
      +
      • First stable LTS release, now following SemVer.
        We'd like to emphasize that this component is production ready and battle-tested.
        We plan to support all long-term support (LTS) releases for at least 24 months,
        so you have a rock-solid foundation to build on top of.
      -

      Contains no other changes, so it's actually fully compatible with the v0.7.7 release.

      +

      Contains no other changes, so it's actually fully compatible with the v0.7.7 release.


      @@ -4541,14 +283,14 @@

      -
        +
        • First stable LTS release, now following SemVer.
          We'd like to emphasize that this component is production ready and battle-tested.
          We plan to support all long-term support (LTS) releases for at least 24 months,
          so you have a rock-solid foundation to build on top of.
        -

        Contains no other changes, so it's actually fully compatible with the v0.5.3 release.

        +

        Contains no other changes, so it's actually fully compatible with the v0.5.3 release.


        @@ -4566,18 +308,18 @@

        -
          +
          • -

            Improve performance by importing global functions.
            -(#167 by @Ocramius)

            +

            Improve performance by importing global functions.
            +(#167 by @Ocramius)

          • -

            Improve test suite by simplifying test bootstrap by using dev autoloader.
            -(#169 by @lcobucci)

            +

            Improve test suite by simplifying test bootstrap by using dev autoloader.
            +(#169 by @lcobucci)

          • -

            Minor internal changes to improved backward compatibility with PHP 5.3.
            -(#166 by @Donatello-za)

            +

            Minor internal changes to improved backward compatibility with PHP 5.3.
            +(#166 by @Donatello-za)

          @@ -4596,29 +338,29 @@

          -
            +
            • -

              Feature: Add resolveAll() method to support custom query types in Resolver.
              -(#110 by @clue and @WyriHaximus)

              -
              $resolver->resolveAll('reactphp.org', Message::TYPE_AAAA)->then(function ($ips) {
              -    echo 'IPv6 addresses for reactphp.org ' . implode(', ', $ips) . PHP_EOL;
              -});
              +

              Feature: Add resolveAll() method to support custom query types in Resolver.
              +(#110 by @clue and @WyriHaximus)

              +
              $resolver->resolveAll('reactphp.org', Message::TYPE_AAAA)->then(function ($ips) {
              +    echo 'IPv6 addresses for reactphp.org ' . implode(', ', $ips) . PHP_EOL;
              +});
            • -

              Feature: Support parsing NS, TXT, MX, SOA and SRV records.
              -(#104, #105, #106, #107 and #108 by @clue)

              +

              Feature: Support parsing NS, TXT, MX, SOA and SRV records.
              +(#104, #105, #106, #107 and #108 by @clue)

            • -

              Feature: Add support for Message::TYPE_ANY and parse unknown types as binary data.
              -(#104 by @clue)

              +

              Feature: Add support for Message::TYPE_ANY parse unknown types as binary data.
              +(#104 by @clue)

            • -

              Feature: Improve error messages for failed queries and improve documentation.
              -(#109 by @clue)

              +

              Feature: Improve error messages for failed queries and improve documentation.
              +(#109 by @clue)

            • -

              Feature: Add reverse DNS lookup example.
              -(#111 by @clue)

              +

              Feature: Add reverse DNS lookup example.
              +(#111 by @clue)

            @@ -4637,19 +379,19 @@

            -
              +
              • -

                Feature: Add UdpTransportExecutor, validate incoming DNS response messages
                -to avoid cache poisoning attacks and deprecate legacy Executor.
                -(#101 and #103 by @clue)

                +

                Feature: Add UdpTransportExecutor, validate incoming DNS response messages
                +to avoid cache poisoning attacks and deprecate legacy Executor.
                +(#101 and #103 by @clue)

              • -

                Feature: Forward compatibility with Cache 0.5
                -(#102 by @clue)

                +

                Feature: Forward compatibility with Cache 0.5
                +(#102 by @clue)

              • -

                Deprecate legacy Query::$currentTime and binary parser data attributes to clean up and simplify API.
                -(#99 by @clue)

                +

                Deprecate legacy Query::$currentTime and binary parser data attributes to clean up and simplify API.
                +(#99 by @clue)

              @@ -4668,22 +410,22 @@

              -
                +
                • -

                  Improve documentation by describing what is expected of a class implementing CacheInterface.
                  -(#21, #22, #23, #27 by @WyriHaximus)

                  +

                  Improve documentation by describing what is expected of a class implementing CacheInterface.
                  +(#21, #22, #23, #27 by @WyriHaximus)

                • -

                  Implemented (optional) Least Recently Used (LRU) cache algorithm for ArrayCache.
                  -(#26 by @clue)

                  +

                  Implemented (optional) Least Recently Used (LRU) cache algorithm for ArrayCache.
                  +(#26 by @clue)

                • -

                  Added support for cache expiration (TTL).
                  -(#29 by @clue and @WyriHaximus)

                  +

                  Added support for cache expiration (TTL).
                  +(#29 by @clue and @WyriHaximus)

                • -

                  Renamed remove to delete making it more in line with PSR-16.
                  -(#30 by @clue)

                  +

                  Renamed remove to delete making it more in line with PSR-16.
                  +(#30 by @clue)

                @@ -4702,9 +444,9 @@

                -
                  +
                  • Feature: Improve memory consumption by cleaning up garbage references to pending promise without canceller.
                    -(#34 by @clue)
                  • +(#34 by @clue)

                  @@ -4722,9 +464,9 @@

                  -
                    +
                    • Feature: Improve memory consumption for pending promises by using static internal callbacks without binding to self.
                      -(#124 by @clue)
                    • +(#124 by @clue)

                    @@ -4742,14 +484,14 @@

                    -
                      +
                      • -

                        Feature: Improve memory consumption for failed and cancelled connection attempts.
                        -(#161 by @clue)

                        +

                        Feature: Improve memory consumption for failed and cancelled connection attempts.
                        +(#161 by @clue)

                      • -

                        Improve test suite to fix Travis config to test against legacy PHP 5.3 again.
                        -(#162 by @clue)

                        +

                        Improve test suite to fix Travis config to test against legacy PHP 5.3 again.
                        +(#162 by @clue)

                      @@ -4768,9 +510,9 @@

                      -
                        +
                        • Feature: Improve memory consumption by cleaning up garbage references.
                          -(#33 by @clue)
                        • +(#33 by @clue)

                        @@ -4788,35 +530,35 @@

                        -
                          +
                          • -

                            Feature: Significantly improve memory consumption and performance by only passing resolver args
                            +

                            Feature: Significantly improve memory consumption and performance by only passing resolver args
                            to resolver and canceller if callback requires them. Also use static callbacks without
                            binding to promise, clean up canceller function reference when they are no longer
                            needed and hide resolver and canceller references from call stack on PHP 7+.
                            -(#113, #115, #116, #117, #118, #119 and #123 by @clue)

                            -

                            These changes combined mean that rejecting promises with an Exception should
                            +(#113, #115, #116, #117, #118, #119 and #123 by @clue)

                            +

                            These changes combined mean that rejecting promises with an Exception should
                            no longer cause any internal circular references which could cause some unexpected
                            memory growth in previous versions. By explicitly avoiding and explicitly
                            cleaning up said references, we can avoid relying on PHP's circular garbage collector
                            to kick in which significantly improves performance when rejecting many promises.

                          • -

                            Mark legacy progress support / notification API as deprecated
                            -(#112 by @clue)

                            +

                            Mark legacy progress support / notification API as deprecated
                            +(#112 by @clue)

                          • -

                            Recommend rejecting promises by throwing an exception
                            -(#114 by @jsor)

                            +

                            Recommend rejecting promises by throwing an exception
                            +(#114 by @jsor)

                          • -

                            Improve documentation to properly instantiate LazyPromise
                            -(#121 by @holtkamp)

                            +

                            Improve documentation to properly instantiate LazyPromise
                            +(#121 by @holtkamp)

                          • -

                            Follower cancellation propagation was originally planned for this release
                            +

                            Follower cancellation propagation was originally planned for this release
                            but has been reverted for now and is planned for a future release.
                            -(#99 by @jsor and #122 by @clue)

                            +(#99 by @jsor and #122 by @clue)

                          @@ -4835,9 +577,9 @@

                          -
                            +
                            • Feature: Improve memory consumption by cleaning up unneeded references.
                              -(#32 by @clue)
                            • +(#32 by @clue)

                            @@ -4855,10 +597,10 @@

                            -
                              +
                              • Feature: Improve memory consumption for cancelled connection attempts and
                                simplify skipping DNS lookup when connecting to IP addresses.
                                -(#159 and #160 by @clue)
                              • +(#159 and #160 by @clue)

                              @@ -4876,14 +618,14 @@

                              -
                                +
                                • -

                                  Feature: Improve memory consumption and runtime performance for StreamSelectLoop timers.
                                  -(#164 by @clue)

                                  +

                                  Feature: Improve memory consumption and runtime performance for StreamSelectLoop timers.
                                  +(#164 by @clue)

                                • -

                                  Improve test suite by removing I/O dependency at StreamSelectLoopTest to fix Mac OS X tests.
                                  -(#161 by @nawarian)

                                  +

                                  Improve test suite by removing I/O dependency at StreamSelectLoopTest to fix Mac OS X tests.
                                  +(#161 by @nawarian)

                                @@ -4902,22 +644,22 @@

                                -
                                  +
                                  • -

                                    Feature: Do not pause connection stream to detect closed connections immediately.
                                    -(#315 by @clue)

                                    +

                                    Feature: Do not pause connection stream to detect closed connections immediately.
                                    +(#315 by @clue)

                                  • -

                                    Feature: Keep incoming Transfer-Encoding: chunked request header.
                                    -(#316 by @clue)

                                    +

                                    Feature: Keep incoming Transfer-Encoding: chunked request header.
                                    +(#316 by @clue)

                                  • -

                                    Feature: Reject invalid requests that contain both Content-Length and Transfer-Encoding request headers.
                                    -(#318 by @clue)

                                    +

                                    Feature: Reject invalid requests that contain both Content-Length and Transfer-Encoding request headers.
                                    +(#318 by @clue)

                                  • -

                                    Minor internal refactoring to simplify connection close logic after sending response.
                                    -(#317 by @clue)

                                    +

                                    Minor internal refactoring to simplify connection close logic after sending response.
                                    +(#317 by @clue)

                                  @@ -4926,7 +668,7 @@

                                  - HttpClient 0.5.9 + HTTPClient 0.5.9 (2018-04-10) @@ -4936,14 +678,14 @@

                                  -
                                    +
                                    • -

                                      Feature: Support legacy HTTP servers that use only LF instead of CRLF.
                                      -(#130 by @clue)

                                      +

                                      Feature: Support legacy HTTP servers that use only LF instead of CRLF.
                                      +(#130 by @clue)

                                    • -

                                      Improve test suite by applying maximum test timeouts for integration tests.
                                      -(#131 by @clue)

                                      +

                                      Improve test suite by applying maximum test timeouts for integration tests.
                                      +(#131 by @clue)

                                    @@ -4962,8 +704,8 @@

                                    -
                                      -
                                    • Feature: New ExtEvLoop (PECL ext-ev) (#148 by @kaduev13)
                                    • +
                                      @@ -4981,26 +723,26 @@

                                      -
                                        +
                                        • -

                                          Fix: Do not pass $next handler to final request handler.
                                          -(#308 by @clue)

                                          +

                                          Fix: Do not pass $next handler to final request handler.
                                          +(#308 by @clue)

                                        • -

                                          Fix: Fix awaiting queued handlers when cancelling a queued handler.
                                          -(#313 by @clue)

                                          +

                                          Fix: Fix awaiting queued handlers when cancelling a queued handler.
                                          +(#313 by @clue)

                                        • -

                                          Fix: Fix Server to skip SERVER_ADDR params for Unix domain sockets (UDS).
                                          -(#307 by @clue)

                                          +

                                          Fix: Fix Server to skip SERVER_ADDR params for Unix domain sockets (UDS).
                                          +(#307 by @clue)

                                        • -

                                          Documentation for PSR-15 middleware and minor documentation improvements.
                                          -(#314 by @clue and #297, #298 and #310 by @seregazhuk)

                                          +

                                          Documentation for PSR-15 middleware and minor documentation improvements.
                                          +(#314 by @clue and #297, #298 and #310 by @seregazhuk)

                                        • -

                                          Minor code improvements and micro optimizations.
                                          -(#301 by @seregazhuk and #305 by @kalessil)

                                          +

                                          Minor code improvements and micro optimizations.
                                          +(#301 by @seregazhuk and #305 by @kalessil)

                                        @@ -5019,215 +761,215 @@

                                        -

                                        A major feature release with a significant documentation overhaul and long overdue API cleanup!

                                        -

                                        This update involves a number of BC breaks due to dropped support for deprecated
                                        +

                                        A major feature release with a significant documentation overhaul and long overdue API cleanup!

                                        +

                                        This update involves a number of BC breaks due to dropped support for deprecated
                                        functionality. We've tried hard to avoid BC breaks where possible and minimize
                                        impact otherwise. We expect that most consumers of this package will actually
                                        not be affected by any BC breaks, see below for more details.

                                        -

                                        We realize that the changes listed below may seem overwhelming, but we've tried
                                        +

                                        We realize that the changes listed below may seem overwhelming, but we've tried
                                        to be very clear about any possible BC breaks. Don't worry: In fact, all ReactPHP
                                        components are already compatible and support both this new release as well as
                                        providing backwards compatibility with the last release.

                                        -
                                          +
                                          • -

                                            Feature / BC break: Add support for signal handling via new
                                            -LoopInterface::addSignal() and LoopInterface::removeSignal() methods.
                                            -(#104 by @WyriHaximus and #111 and #150 by @clue)

                                            -
                                            $loop->addSignal(SIGINT, function () {
                                            -    echo 'CTRL-C';
                                            -});
                                            +

                                            Feature / BC break: Add support for signal handling via new
                                            +LoopInterface::addSignal() and LoopInterface::removeSignal() methods.
                                            +(#104 by @WyriHaximus and #111 and #150 by @clue)

                                            +
                                            $loop->addSignal(SIGINT, function () {
                                            +    echo 'CTRL-C';
                                            +});
                                          • -

                                            Feature: Significant documentation updates for LoopInterface and Factory.
                                            -(#100, #119, #126, #127, #159 and #160 by @clue, #113 by @WyriHaximus and #81 and #91 by @jsor)

                                            +

                                            Feature: Significant documentation updates for LoopInterface and Factory.
                                            +(#100, #119, #126, #127, #159 and #160 by @clue, #113 by @WyriHaximus and #81 and #91 by @jsor)

                                          • -

                                            Feature: Add examples to ease getting started
                                            -(#99, #100 and #125 by @clue, #59 by @WyriHaximus and #143 by @jsor)

                                            +

                                            Feature: Add examples to ease getting started
                                            +(#99, #100 and #125 by @clue, #59 by @WyriHaximus and #143 by @jsor)

                                          • -

                                            Feature: Documentation for advanced timer concepts, such as monotonic time source vs wall-clock time
                                            +

                                            Feature: Documentation for advanced timer concepts, such as monotonic time source vs wall-clock time
                                            and high precision timers with millisecond accuracy or below.
                                            -(#130 and #157 by @clue)

                                            +(#130 and #157 by @clue)

                                          • -

                                            Feature: Documentation for advanced stream concepts, such as edge-triggered event listeners
                                            +

                                            Feature: Documentation for advanced stream concepts, such as edge-triggered event listeners
                                            and stream buffers and allow throwing Exception if stream resource is not supported.
                                            -(#129 and #158 by @clue)

                                            +(#129 and #158 by @clue)

                                          • -

                                            Feature: Throw BadMethodCallException on manual loop creation when required extension isn't installed.
                                            -(#153 by @WyriHaximus)

                                            +

                                            Feature: Throw BadMethodCallException on manual loop creation when required extension isn't installed.
                                            +(#153 by @WyriHaximus)

                                          • -

                                            Feature / BC break: First class support for legacy PHP 5.3 through PHP 7.2 and HHVM
                                            -and remove all callable type hints for consistency reasons.
                                            -(#141 and #151 by @clue)

                                            +

                                            Feature / BC break: First class support for legacy PHP 5.3 through PHP 7.2 and HHVM
                                            +and remove all callable type hints for consistency reasons.
                                            +(#141 and #151 by @clue)

                                          • -

                                            BC break: Documentation for timer API and clean up unneeded timer API.
                                            -(#102 by @clue)

                                            -

                                            Remove TimerInterface::cancel(), use LoopInterface::cancelTimer() instead:

                                            -
                                            // old (method invoked on timer instance)
                                            -$timer->cancel();
                                            -
                                            -// already supported before: invoke method on loop instance
                                            -$loop->cancelTimer($timer);
                                            -

                                            Remove unneeded TimerInterface::setData() and TimerInterface::getData(),
                                            +

                                            BC break: Documentation for timer API and clean up unneeded timer API.
                                            +(#102 by @clue)

                                            +

                                            Remove TimerInterface::cancel(), use LoopInterface::cancelTimer() instead:

                                            +
                                            // old (method invoked on timer instance)
                                            +$timer->cancel();
                                            +
                                            +// already supported before: invoke method on loop instance
                                            +$loop->cancelTimer($timer);
                                            +

                                            Remove unneeded TimerInterface::setData() and TimerInterface::getData(),
                                            use closure binding to add arbitrary data to timer instead:

                                            -
                                            // old (limited setData() and getData() only allows single variable)
                                            -$name = 'Tester';
                                            -$timer = $loop->addTimer(1.0, function ($timer) {
                                            -    echo 'Hello ' . $timer->getData() . PHP_EOL;
                                            -});
                                            -$timer->setData($name);
                                            -
                                            -// already supported before: closure binding allows any number of variables
                                            -$name = 'Tester';
                                            -$loop->addTimer(1.0, function () use ($name) {
                                            -    echo 'Hello ' . $name . PHP_EOL;
                                            -});
                                            -

                                            Remove unneeded TimerInterface::getLoop(), use closure binding instead:

                                            -
                                            // old (getLoop() called on timer instance)
                                            -$loop->addTimer(0.1, function ($timer) {
                                            -    $timer->getLoop()->stop();
                                            -});
                                            -
                                            -// already supported before: use closure binding as usual
                                            -$loop->addTimer(0.1, function () use ($loop) {
                                            -    $loop->stop();
                                            -});
                                            -
                                          • -
                                          • -

                                            BC break: Remove unneeded LoopInterface::isTimerActive() and
                                            -TimerInterface::isActive() to reduce API surface.
                                            -(#133 by @clue)

                                            -
                                            // old (method on timer instance or on loop instance)
                                            -$timer->isActive();
                                            -$loop->isTimerActive($timer);
                                            -
                                          • -
                                          • -

                                            BC break: Move TimerInterface one level up to React\EventLoop\TimerInterface.
                                            -(#138 by @WyriHaximus)

                                            -
                                            // old (notice obsolete "Timer" namespace)
                                            -assert($timer instanceof React\EventLoop\Timer\TimerInterface);
                                            -
                                            -// new
                                            -assert($timer instanceof React\EventLoop\TimerInterface);
                                            -
                                          • -
                                          • -

                                            BC break: Remove unneeded LoopInterface::nextTick() (and internal NextTickQueue),
                                            -use LoopInterface::futureTick() instead.
                                            -(#30 by @clue)

                                            -
                                            // old (removed)
                                            -$loop->nextTick(function () {
                                            -    echo 'tick';
                                            -});
                                            -
                                            -// already supported before
                                            -$loop->futureTick(function () {
                                            -    echo 'tick';
                                            -});
                                            -
                                          • -
                                          • -

                                            BC break: Remove unneeded $loop argument for LoopInterface::futureTick()
                                            +

                                            // old (limited setData() and getData() only allows single variable)
                                            +$name = 'Tester';
                                            +$timer = $loop->addTimer(1.0, function ($timer) {
                                            +    echo 'Hello ' . $timer->getData() . PHP_EOL;
                                            +});
                                            +$timer->setData($name);
                                            +
                                            +// already supported before: closure binding allows any number of variables
                                            +$name = 'Tester';
                                            +$loop->addTimer(1.0, function () use ($name) {
                                            +    echo 'Hello ' . $name . PHP_EOL;
                                            +});
                                            +

                                            Remove unneeded TimerInterface::getLoop(), use closure binding instead:

                                            +
                                            // old (getLoop() called on timer instance)
                                            +$loop->addTimer(0.1, function ($timer) {
                                            +    $timer->getLoop()->stop();
                                            +});
                                            +
                                            +// already supported before: use closure binding as usual
                                            +$loop->addTimer(0.1, function () use ($loop) {
                                            +    $loop->stop();
                                            +});
                                            +
                                          • +
                                          • +

                                            BC break: Remove unneeded LoopInterface::isTimerActive() and
                                            +TimerInterface::isActive() to reduce API surface.
                                            +(#133 by @clue)

                                            +
                                            // old (method on timer instance or on loop instance)
                                            +$timer->isActive();
                                            +$loop->isTimerActive($timer);
                                            +
                                          • +
                                          • +

                                            BC break: Move TimerInterface one level up to React\EventLoop\TimerInterface.
                                            +(#138 by @WyriHaximus)

                                            +
                                            // old (notice obsolete "Timer" namespace)
                                            +assert($timer instanceof React\EventLoop\Timer\TimerInterface);
                                            +
                                            +// new
                                            +assert($timer instanceof React\EventLoop\TimerInterface);
                                            +
                                          • +
                                          • +

                                            BC break: Remove unneeded LoopInterface::nextTick() (and internal NextTickQueue),
                                            +use LoopInterface::futureTick() instead.
                                            +(#30 by @clue)

                                            +
                                            // old (removed)
                                            +$loop->nextTick(function () {
                                            +    echo 'tick';
                                            +});
                                            +
                                            +// already supported before
                                            +$loop->futureTick(function () {
                                            +    echo 'tick';
                                            +});
                                            +
                                          • +
                                          • +

                                            BC break: Remove unneeded $loop argument for LoopInterface::futureTick()
                                            (and fix internal cyclic dependency).
                                            -(#103 by @clue)

                                            -
                                            // old ($loop gets passed by default)
                                            -$loop->futureTick(function ($loop) {
                                            -    $loop->stop();
                                            -});
                                            -
                                            -// already supported before: use closure binding as usual
                                            -$loop->futureTick(function () use ($loop) {
                                            -    $loop->stop();
                                            -});
                                            -
                                          • -
                                          • -

                                            BC break: Remove unneeded LoopInterface::tick().
                                            -(#72 by @jsor)

                                            -
                                            // old (removed)
                                            -$loop->tick();
                                            -
                                            -// suggested work around for testing purposes only
                                            -$loop->futureTick(function () use ($loop) {
                                            -    $loop->stop();
                                            -});
                                            -
                                          • -
                                          • -

                                            BC break: Documentation for advanced stream API and clean up unneeded stream API.
                                            -(#110 by @clue)

                                            -

                                            Remove unneeded $loop argument for LoopInterface::addReadStream()
                                            -and LoopInterface::addWriteStream(), use closure binding instead:

                                            -
                                            // old ($loop gets passed by default)
                                            -$loop->addReadStream($stream, function ($stream, $loop) {
                                            -    $loop->removeReadStream($stream);
                                            -});
                                            -
                                            -// already supported before: use closure binding as usual
                                            -$loop->addReadStream($stream, function ($stream) use ($loop) {
                                            -    $loop->removeReadStream($stream);
                                            -});
                                            -
                                          • -
                                          • -

                                            BC break: Remove unneeded LoopInterface::removeStream() method,
                                            -use LoopInterface::removeReadStream() and LoopInterface::removeWriteStream() instead.
                                            -(#118 by @clue)

                                            -
                                            // old
                                            -$loop->removeStream($stream);
                                            -
                                            -// already supported before
                                            -$loop->removeReadStream($stream);
                                            -$loop->removeWriteStream($stream);
                                            -
                                          • -
                                          • -

                                            BC break: Rename LibEventLoop to ExtLibeventLoop and LibEvLoop to ExtLibevLoop
                                            +(#103 by @clue)

                                            +
                                            // old ($loop gets passed by default)
                                            +$loop->futureTick(function ($loop) {
                                            +    $loop->stop();
                                            +});
                                            +
                                            +// already supported before: use closure binding as usual
                                            +$loop->futureTick(function () use ($loop) {
                                            +    $loop->stop();
                                            +});
                                            +
                                          • +
                                          • +

                                            BC break: Remove unneeded LoopInterface::tick().
                                            +(#72 by @jsor)

                                            +
                                            // old (removed)
                                            +$loop->tick();
                                            +
                                            +// suggested work around for testing purposes only
                                            +$loop->futureTick(function () use ($loop) {
                                            +    $loop->stop();
                                            +});
                                            +
                                          • +
                                          • +

                                            BC break: Documentation for advanced stream API and clean up unneeded stream API.
                                            +(#110 by @clue)

                                            +

                                            Remove unneeded $loop argument for LoopInterface::addReadStream()
                                            +and LoopInterface::addWriteStream(), use closure binding instead:

                                            +
                                            // old ($loop gets passed by default)
                                            +$loop->addReadStream($stream, function ($stream, $loop) {
                                            +    $loop->removeReadStream($stream);
                                            +});
                                            +
                                            +// already supported before: use closure binding as usual
                                            +$loop->addReadStream($stream, function ($stream) use ($loop) {
                                            +    $loop->removeReadStream($stream);
                                            +});
                                            +
                                          • +
                                          • +

                                            BC break: Remove unneeded LoopInterface::removeStream() method,
                                            +use LoopInterface::removeReadStream() and LoopInterface::removeWriteStream() instead.
                                            +(#118 by @clue)

                                            +
                                            // old
                                            +$loop->removeStream($stream);
                                            +
                                            +// already supported before
                                            +$loop->removeReadStream($stream);
                                            +$loop->removeWriteStream($stream);
                                            +
                                          • +
                                          • +

                                            BC break: Rename LibEventLoop to ExtLibeventLoop and LibEvLoop to ExtLibevLoop
                                            for consistent naming for event loop implementations.
                                            -(#128 by @clue)

                                            +(#128 by @clue)

                                          • -

                                            BC break: Remove optional EventBaseConfig argument from ExtEventLoop
                                            -and make its FEATURE_FDS enabled by default.
                                            -(#156 by @WyriHaximus)

                                            +

                                            BC break: Remove optional EventBaseConfig argument from ExtEventLoop
                                            +and make its FEATURE_FDS enabled by default.
                                            +(#156 by @WyriHaximus)

                                          • -

                                            BC break: Mark all classes as final to discourage inheritance.
                                            -(#131 by @clue)

                                            +

                                            BC break: Mark all classes as final to discourage inheritance.
                                            +(#131 by @clue)

                                          • -

                                            Fix: Fix ExtEventLoop to keep track of stream resources (refcount)
                                            -(#123 by @clue)

                                            +

                                            Fix: Fix ExtEventLoop to keep track of stream resources (refcount)
                                            +(#123 by @clue)

                                          • -

                                            Fix: Ensure large timer interval does not overflow on 32bit systems
                                            -(#132 by @clue)

                                            +

                                            Fix: Ensure large timer interval does not overflow on 32bit systems
                                            +(#132 by @clue)

                                          • -

                                            Fix: Fix separately removing readable and writable side of stream when closing
                                            -(#139 by @clue)

                                            +

                                            Fix: Fix separately removing readable and writable side of stream when closing
                                            +(#139 by @clue)

                                          • -

                                            Fix: Properly clean up event watchers for ext-event and ext-libev
                                            -(#149 by @clue)

                                            +

                                            Fix: Properly clean up event watchers for ext-event and ext-libev
                                            +(#149 by @clue)

                                          • -

                                            Fix: Minor code cleanup and remove unneeded references
                                            -(#145 by @seregazhuk)

                                            +

                                            Fix: Minor code cleanup and remove unneeded references
                                            +(#145 by @seregazhuk)

                                          • -

                                            Fix: Discourage outdated ext-libevent on PHP 7
                                            -(#62 by @cboden)

                                            +

                                            Fix: Discourage outdated ext-libevent on PHP 7
                                            +(#62 by @cboden)

                                          • -

                                            Improve test suite by adding forward compatibility with PHPUnit 6 and PHPUnit 5,
                                            +

                                            Improve test suite by adding forward compatibility with PHPUnit 6 and PHPUnit 5,
                                            lock Travis distro so new defaults will not break the build,
                                            improve test suite to be less fragile and increase test timeouts,
                                            test against PHP 7.2 and reduce fwrite() call length to one chunk.
                                            -(#106 and #144 by @clue, #120 and #124 by @carusogabriel, #147 by nawarian and #92 by @kelunik)

                                            +(#106 and #144 by @clue, #120 and #124 by @carusogabriel, #147 by nawarian and #92 by @kelunik)

                                          • -

                                            A number of changes were originally planned for this release but have been backported
                                            -to the last v0.4.3 already: #74, #76, #79, #81 (refs #65, #66, #67), #88 and #93

                                            +

                                            A number of changes were originally planned for this release but have been backported
                                            +to the last v0.4.3 already: #74, #76, #79, #81 (refs #65, #66, #67), #88 and #93

                                          @@ -5246,21 +988,21 @@

                                          -
                                            +
                                            • -

                                              Feature: Update DNS dependency to support loading system default DNS
                                              +

                                              Feature: Update DNS dependency to support loading system default DNS
                                              nameserver config on all supported platforms
                                              -(/etc/resolv.conf on Unix/Linux/Mac/Docker/WSL and WMIC on Windows)
                                              -(#23 by @clue)

                                              -

                                              This means that connecting to hosts that are managed by a local DNS server,
                                              +(/etc/resolv.conf on Unix/Linux/Mac/Docker/WSL and WMIC on Windows)
                                              +(#23 by @clue)

                                              +

                                              This means that connecting to hosts that are managed by a local DNS server,
                                              such as a corporate DNS server or when using Docker containers, will now
                                              work as expected across all platforms with no changes required:

                                              -
                                              $factory = new Factory($loop);
                                              -$factory->createClient('intranet.example:5353');
                                              +
                                              $factory = new Factory($loop);
                                              +$factory->createClient('intranet.example:5353');
                                            • -

                                              Improve README
                                              -(#22 by @jsor)

                                              +

                                              Improve README
                                              +(#22 by @jsor)

                                            @@ -5279,19 +1021,19 @@

                                            -
                                              +
                                              • -

                                                Feature: Update DNS dependency to support loading system default DNS
                                                +

                                                Feature: Update DNS dependency to support loading system default DNS
                                                nameserver config on all supported platforms
                                                -(/etc/resolv.conf on Unix/Linux/Mac/Docker/WSL and WMIC on Windows)
                                                -(#152 by @clue)

                                                -

                                                This means that connecting to hosts that are managed by a local DNS server,
                                                +(/etc/resolv.conf on Unix/Linux/Mac/Docker/WSL and WMIC on Windows)
                                                +(#152 by @clue)

                                                +

                                                This means that connecting to hosts that are managed by a local DNS server,
                                                such as a corporate DNS server or when using Docker containers, will now
                                                work as expected across all platforms with no changes required:

                                                -
                                                $connector = new Connector($loop);
                                                -$connector->connect('intranet.example:80')->then(function ($connection) {
                                                -    // …
                                                -});
                                                +
                                                $connector = new Connector($loop);
                                                +$connector->connect('intranet.example:80')->then(function ($connection) {
                                                +    //
                                                +});
                                              @@ -5310,18 +1052,18 @@

                                              -
                                                +
                                                • -

                                                  Add Config::loadSystemConfigBlocking() to load default system config
                                                  +

                                                  Add Config::loadSystemConfigBlocking() to load default system config
                                                  and support parsing DNS config on all supported platforms
                                                  -(/etc/resolv.conf on Unix/Linux/Mac and WMIC on Windows)
                                                  -(#92, #93, #94 and #95 by @clue)

                                                  -
                                                  $config = Config::loadSystemConfigBlocking();
                                                  -$server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8';
                                                  +(/etc/resolv.conf on Unix/Linux/Mac and WMIC on Windows)
                                                  +(#92, #93, #94 and #95 by @clue)

                                                  +
                                                  $config = Config::loadSystemConfigBlocking();
                                                  +$server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8';
                                                • -

                                                  Remove unneeded cyclic dependency on react/socket
                                                  -(#96 by @clue)

                                                  +

                                                  Remove unneeded cyclic dependency on react/socket
                                                  +(#96 by @clue)

                                                @@ -5330,7 +1072,7 @@

                                                - HttpClient 0.5.8 + HTTPClient 0.5.8 (2018-02-09) @@ -5340,15 +1082,15 @@

                                                -
                                                  +
                                                  • -

                                                    Support legacy PHP 5.3 through PHP 7.2 and HHVM
                                                    -(#126 and #127 by @clue)

                                                    +

                                                    Support legacy PHP 5.3 through PHP 7.2 and HHVM
                                                    +(#126 and #127 by @clue)

                                                  • -

                                                    Improve backwards compatibility with Promise v1 and
                                                    +

                                                    Improve backwards compatibility with Promise v1 and
                                                    use RingCentral to improve interoperability with react/http.
                                                    -(#124 and #125 by @clue)

                                                    +(#124 and #125 by @clue)

                                                  @@ -5357,7 +1099,7 @@

                                                  - HttpClient 0.5.7 + HTTPClient 0.5.7 (2018-02-08) @@ -5367,22 +1109,22 @@

                                                  -
                                                    +
                                                    • -

                                                      Fix: Ignore excessive whitespace in chunk header for Transfer-Encoding: chunked
                                                      -(#123 by @DangerLifter and @clue)

                                                      +

                                                      Fix: Ignore excessive whitespace in chunk header for Transfer-Encoding: chunked
                                                      +(#123 by @DangerLifter and @clue)

                                                    • -

                                                      Fix: Ignore invalid incoming Transfer-Encoding response header
                                                      -(#122 by @clue)

                                                      +

                                                      Fix: Ignore invalid incoming Transfer-Encoding response header
                                                      +(#122 by @clue)

                                                    • -

                                                      Improve documentation for Client (and advanced Connector)
                                                      -(#111 by @jsor and #121 by @clue)

                                                      +

                                                      Improve documentation for Client (and advanced Connector)
                                                      +(#111 by @jsor and #121 by @clue)

                                                    • -

                                                      Improve test suite by adding support for PHPUnit 6
                                                      -(#112 by @carusogabriel)

                                                      +

                                                      Improve test suite by adding support for PHPUnit 6
                                                      +(#112 by @carusogabriel)

                                                    @@ -5401,11 +1143,11 @@

                                                    -
                                                      +
                                                      • Improve test suite by fixing forward compatibility with upcoming EventLoop
                                                        releases, avoid risky tests and add test group to skip integration tests
                                                        relying on internet connection and apply appropriate test timeouts.
                                                        -(#128, #131 and #132 by @clue)
                                                      • +(#128, #131 and #132 by @clue)

                                                      @@ -5423,18 +1165,18 @@

                                                      -
                                                        +
                                                        • -

                                                          Feature: Detect "exit" immediately if last process pipe is closed
                                                          -(#58 by @clue)

                                                          -

                                                          This introduces a simple check to see if the program is already known to be
                                                          +

                                                          Feature: Detect "exit" immediately if last process pipe is closed
                                                          +(#58 by @clue)

                                                          +

                                                          This introduces a simple check to see if the program is already known to be
                                                          closed when the last process pipe is closed instead of relying on a periodic
                                                          timer. This simple change improves "exit" detection significantly for most
                                                          programs and does not cause a noticeable penalty for more advanced use cases.

                                                        • -

                                                          Fix forward compatibility with upcoming EventLoop releases
                                                          -(#56 by @clue)

                                                          +

                                                          Fix forward compatibility with upcoming EventLoop releases
                                                          +(#56 by @clue)

                                                        @@ -5453,24 +1195,24 @@

                                                        -
                                                          +
                                                          • -

                                                            Feature: Support explicitly choosing TLS version to negotiate with remote side
                                                            -by respecting crypto_method context parameter for all classes.
                                                            -(#149 by @clue)

                                                            -

                                                            By default, all connector and server classes support TLSv1.0+ and exclude
                                                            +

                                                            Feature: Support explicitly choosing TLS version to negotiate with remote side
                                                            +by respecting crypto_method context parameter for all classes.
                                                            +(#149 by @clue)

                                                            +

                                                            By default, all connector and server classes support TLSv1.0+ and exclude
                                                            support for legacy SSLv2/SSLv3. As of PHP 5.6+ you can also explicitly
                                                            choose the TLS version you want to negotiate with the remote side:

                                                            -
                                                            // new: now supports 'crypto_method` context parameter for all classes
                                                            -$connector = new Connector($loop, array(
                                                            -    'tls' => array(
                                                            -        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
                                                            -    )
                                                            -));
                                                            +
                                                            // new: now supports 'crypto_method` context parameter for all classes
                                                            +$connector = new Connector($loop, array(
                                                            +    'tls' => array(
                                                            +        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
                                                            +    )
                                                            +));
                                                          • -

                                                            Minor internal clean up to unify class imports
                                                            -(#148 by @clue)

                                                            +

                                                            Minor internal clean up to unify class imports
                                                            +(#148 by @clue)

                                                          @@ -5489,12 +1231,12 @@

                                                          -
                                                            +
                                                            • Improve test suite by adding forward compatibility with PHPUnit 6,
                                                              test against PHP 7.2, fix forward compatibility with upcoming EventLoop releases,
                                                              add test group to skip integration tests relying on internet connection
                                                              and add minor documentation improvements.
                                                              -(#85 and #87 by @carusogabriel, #88 and #89 by @clue and #83 by @jsor)
                                                            • +(#85 and #87 by @carusogabriel, #88 and #89 by @clue and #83 by @jsor)

                                                            @@ -5512,10 +1254,10 @@

                                                            -
                                                              +
                                                              • Improve test suite by adding test group to skip integration tests relying on
                                                                internet connection and fix minor documentation typo.
                                                                -(#146 by @clue and #145 by @cn007b)
                                                              • +(#146 by @clue and #145 by @cn007b)

                                                              @@ -5533,26 +1275,26 @@

                                                              -
                                                                +
                                                                • -

                                                                  Major request handler performance improvement. Benchmarks suggest number of
                                                                  -requests/s improved by more than 50% for common GET requests!
                                                                  +

                                                                  Major request handler performance improvement. Benchmarks suggest number of
                                                                  +requests/s improved by more than 50% for common GET requests!
                                                                  We now avoid queuing, buffering and wrapping incoming requests in promises
                                                                  when we're below limits and instead can directly process common requests.
                                                                  -(#291, #292, #293, #294 and #296 by @clue)

                                                                  +(#291, #292, #293, #294 and #296 by @clue)

                                                                • -

                                                                  Fix: Fix concurrent invoking next middleware request handlers
                                                                  -(#293 by @clue)

                                                                  +

                                                                  Fix: Fix concurrent invoking next middleware request handlers
                                                                  +(#293 by @clue)

                                                                • -

                                                                  Small code improvements
                                                                  -(#286 by @seregazhuk)

                                                                  +

                                                                  Small code improvements
                                                                  +(#286 by @seregazhuk)

                                                                • -

                                                                  Improve test suite to be less fragile when using ext-event and
                                                                  +

                                                                  Improve test suite to be less fragile when using ext-event and
                                                                  fix test suite forward compatibility with upcoming EventLoop releases
                                                                  -(#288 and #290 by @clue)

                                                                  +(#288 and #290 by @clue)

                                                                @@ -5576,17 +1318,17 @@

                                                                -
                                                                  +
                                                                  • -

                                                                    Fix: Fix closing socket resource before removing from loop
                                                                    -(#141 by @clue)

                                                                    -

                                                                    This fixes the root cause of an uncaught Exception that only manifested
                                                                    +

                                                                    Fix: Fix closing socket resource before removing from loop
                                                                    +(#141 by @clue)

                                                                    +

                                                                    This fixes the root cause of an uncaught Exception that only manifested
                                                                    itself after the recent Stream v0.7.4 component update and only if you're
                                                                    -using ext-event (ExtEventLoop).

                                                                    +using ext-event (ExtEventLoop).

                                                                  • -

                                                                    Improve test suite by testing against PHP 7.2
                                                                    -(#140 by @carusogabriel)

                                                                    +

                                                                    Improve test suite by testing against PHP 7.2
                                                                    +(#140 by @carusogabriel)

                                                                  @@ -5605,15 +1347,15 @@

                                                                  -
                                                                    +
                                                                    • -

                                                                      README improvements
                                                                      -(#28 by @jsor)

                                                                      +

                                                                      README improvements
                                                                      +(#28 by @jsor)

                                                                    • -

                                                                      Improve test suite by adding forward compatiblity with PHPUnit 6 and
                                                                      +

                                                                      Improve test suite by adding forward compatiblity with PHPUnit 6 and
                                                                      fix test suite forward compatibility with upcoming EventLoop releases
                                                                      -(#30 and #31 by @clue)

                                                                      +(#30 and #31 by @clue)

                                                                    @@ -5632,16 +1374,16 @@

                                                                    -
                                                                      +
                                                                      • -

                                                                        Fix: Fix all() to assume null values if no event data is passed
                                                                        -(#13 by @clue)

                                                                        +

                                                                        Fix: Fix all() to assume null values if no event data is passed
                                                                        +(#13 by @clue)

                                                                      • -

                                                                        Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                        +

                                                                        Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                        add forward compatibility with PHPUnit 5 and PHPUnit 6 and
                                                                        test against PHP 7.1 and 7.2
                                                                        -(#11 and #12 by @clue and #9 by @carusogabriel)

                                                                        +(#11 and #12 by @clue and #9 by @carusogabriel)

                                                                      @@ -5660,16 +1402,16 @@

                                                                      -
                                                                        +
                                                                        • -

                                                                          Fix: Update Stream dependency to work around SEGFAULT in legacy PHP < 5.4.28
                                                                          +

                                                                          Fix: Update Stream dependency to work around SEGFAULT in legacy PHP < 5.4.28
                                                                          and PHP < 5.5.12
                                                                          -(#50 and #52 by @clue)

                                                                          +(#50 and #52 by @clue)

                                                                        • -

                                                                          Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                          +

                                                                          Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                          adding forward compatibility with PHPUnit 6
                                                                          -(#53, #54 and #55 by @clue)

                                                                          +(#53, #54 and #55 by @clue)

                                                                        @@ -5688,15 +1430,15 @@

                                                                        -
                                                                          +
                                                                          • -

                                                                            Fix: Work around reading from unbuffered pipe stream in legacy PHP < 5.4.28 and PHP < 5.5.12
                                                                            -(#126 by @clue)

                                                                            +

                                                                            Fix: Work around reading from unbuffered pipe stream in legacy PHP < 5.4.28 and PHP < 5.5.12
                                                                            +(#126 by @clue)

                                                                          • -

                                                                            Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                            +

                                                                            Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                            test against PHP 7.2
                                                                            -(#127 by @clue and #124 by @carusogabriel)

                                                                            +(#127 by @clue and #124 by @carusogabriel)

                                                                          @@ -5715,16 +1457,16 @@

                                                                          -
                                                                            +
                                                                            • -

                                                                              Improve documentation with usage and installation instructions
                                                                              -(#10 by @clue)

                                                                              +

                                                                              Improve documentation with usage and installation instructions
                                                                              +(#10 by @clue)

                                                                            • -

                                                                              Improve test suite by adding PHPUnit to require-dev and
                                                                              +

                                                                              Improve test suite by adding PHPUnit to require-dev and
                                                                              add forward compatibility with PHPUnit 5 and PHPUnit 6 and
                                                                              sanitize Composer autoload paths
                                                                              -(#14 by @shaunbramley and #12 and #18 by @clue)

                                                                              +(#14 by @shaunbramley and #12 and #18 by @clue)

                                                                            @@ -5743,102 +1485,102 @@

                                                                            -
                                                                              +
                                                                              • -

                                                                                Feature / BC break: Add new Server facade that buffers and parses incoming
                                                                                +

                                                                                Feature / BC break: Add new Server facade that buffers and parses incoming
                                                                                HTTP requests. This provides full PSR-7 compatibility, including support for
                                                                                form submissions with POST fields and file uploads.
                                                                                -The old Server has been renamed to StreamingServer for advanced usage
                                                                                +The old Server has been renamed to StreamingServer for advanced usage
                                                                                and is used internally.
                                                                                -(#266, #271, #281, #282, #283 and #284 by @WyriHaximus and @clue)

                                                                                -
                                                                                // old: handle incomplete/streaming requests
                                                                                -$server = new Server($handler);
                                                                                -
                                                                                -// new: handle complete, buffered and parsed requests
                                                                                -// new: full PSR-7 support, including POST fields and file uploads
                                                                                -$server = new Server($handler);
                                                                                -
                                                                                -// new: handle incomplete/streaming requests
                                                                                -$server = new StreamingServer($handler);
                                                                                +(#266, #271, #281, #282, #283 and #284 by @WyriHaximus and @clue)

                                                                                +
                                                                                // old: handle incomplete/streaming requests
                                                                                +$server = new Server($handler);
                                                                                +
                                                                                +// new: handle complete, buffered and parsed requests
                                                                                +// new: full PSR-7 support, including POST fields and file uploads
                                                                                +$server = new Server($handler);
                                                                                +
                                                                                +// new: handle incomplete/streaming requests
                                                                                +$server = new StreamingServer($handler);
                                                                                -

                                                                                While this is technically a small BC break, this should in fact not break
                                                                                +

                                                                                While this is technically a small BC break, this should in fact not break
                                                                                most consuming code. If you rely on the old request streaming, you can
                                                                                -explicitly use the advanced StreamingServer to restore old behavior.

                                                                                +explicitly use the advanced StreamingServer to restore old behavior.

                                                                              • -

                                                                                Feature: Add support for middleware request handler arrays
                                                                                -(#215, #228, #229, #236, #237, #238, #246, #247, #277, #279 and #285 by @WyriHaximus, @clue and @jsor)

                                                                                -
                                                                                // new: middleware request handler arrays
                                                                                -$server = new Server(array(
                                                                                -    function (ServerRequestInterface $request, callable $next) {
                                                                                -        $request = $request->withHeader('Processed', time());
                                                                                -        return $next($request);
                                                                                -    },
                                                                                -    function (ServerRequestInterface $request) {
                                                                                -        return new Response();
                                                                                -    }
                                                                                -));
                                                                                -
                                                                              • -
                                                                              • -

                                                                                Feature: Add support for limiting how many next request handlers can be
                                                                                -executed concurrently (LimitConcurrentRequestsMiddleware)
                                                                                -(#272 by @clue and @WyriHaximus)

                                                                                -
                                                                                // new: explicitly limit concurrency
                                                                                -$server = new Server(array(
                                                                                -    new LimitConcurrentRequestsMiddleware(10),
                                                                                -    $handler
                                                                                -));
                                                                                -
                                                                              • -
                                                                              • -

                                                                                Feature: Add support for buffering the incoming request body
                                                                                -(RequestBodyBufferMiddleware).
                                                                                -This feature mimics PHP's default behavior and respects its post_max_size
                                                                                +

                                                                                Feature: Add support for middleware request handler arrays
                                                                                +(#215, #228, #229, #236, #237, #238, #246, #247, #277, #279 and #285 by @WyriHaximus, @clue and @jsor)

                                                                                +
                                                                                // new: middleware request handler arrays
                                                                                +$server = new Server(array(
                                                                                +    function (ServerRequestInterface $request, callable $next) {
                                                                                +        $request = $request->withHeader('Processed', time());
                                                                                +        return $next($request);
                                                                                +    },
                                                                                +    function (ServerRequestInterface $request) {
                                                                                +        return new Response();
                                                                                +    }
                                                                                +));
                                                                                +
                                                                              • +
                                                                              • +

                                                                                Feature: Add support for limiting how many next request handlers can be
                                                                                +executed concurrently (LimitConcurrentRequestsMiddleware)
                                                                                +(#272 by @clue and @WyriHaximus)

                                                                                +
                                                                                // new: explicitly limit concurrency
                                                                                +$server = new Server(array(
                                                                                +    new LimitConcurrentRequestsMiddleware(10),
                                                                                +    $handler
                                                                                +));
                                                                                +
                                                                              • +
                                                                              • +

                                                                                Feature: Add support for buffering the incoming request body
                                                                                +(RequestBodyBufferMiddleware).
                                                                                +This feature mimics PHP's default behavior and respects its post_max_size
                                                                                ini setting by default and allows explicit configuration.
                                                                                -(#216, #224, #263, #276 and #278 by @WyriHaximus and #235 by @andig)

                                                                                -
                                                                                // new: buffer up to 10 requests with 8 MiB each
                                                                                -$server = new StreamingServer(array(
                                                                                -    new LimitConcurrentRequestsMiddleware(10),
                                                                                -    new RequestBodyBufferMiddleware('8M'),
                                                                                -    $handler
                                                                                -));
                                                                                +(#216, #224, #263, #276 and #278 by @WyriHaximus and #235 by @andig)

                                                                                +
                                                                                // new: buffer up to 10 requests with 8 MiB each
                                                                                +$server = new StreamingServer(array(
                                                                                +    new LimitConcurrentRequestsMiddleware(10),
                                                                                +    new RequestBodyBufferMiddleware('8M'),
                                                                                +    $handler
                                                                                +));
                                                                              • -

                                                                                Feature: Add support for parsing form submissions with POST fields and file
                                                                                -uploads (RequestBodyParserMiddleware).
                                                                                +

                                                                                Feature: Add support for parsing form submissions with POST fields and file
                                                                                +uploads (RequestBodyParserMiddleware).
                                                                                This feature mimics PHP's default behavior and respects its ini settings and
                                                                                -MAX_FILE_SIZE POST fields by default and allows explicit configuration.
                                                                                -(#220, #226, #252, #261, #264, #265, #267, #268, #274 by @WyriHaximus and @clue)

                                                                                -
                                                                                // new: buffer up to 10 requests with 8 MiB each
                                                                                -// and limit to 4 uploads with 2 MiB each
                                                                                -$server = new StreamingServer(array(
                                                                                -    new LimitConcurrentRequestsMiddleware(10),
                                                                                -    new RequestBodyBufferMiddleware('8M'),
                                                                                -    new RequestBodyParserMiddleware('2M', 4)
                                                                                -    $handler
                                                                                -));
                                                                                +MAX_FILE_SIZE POST fields by default and allows explicit configuration.
                                                                                +(#220, #226, #252, #261, #264, #265, #267, #268, #274 by @WyriHaximus and @clue)

                                                                                +
                                                                                // new: buffer up to 10 requests with 8 MiB each
                                                                                +// and limit to 4 uploads with 2 MiB each
                                                                                +$server = new StreamingServer(array(
                                                                                +    new LimitConcurrentRequestsMiddleware(10),
                                                                                +    new RequestBodyBufferMiddleware('8M'),
                                                                                +    new RequestBodyParserMiddleware('2M', 4)
                                                                                +    $handler
                                                                                +));
                                                                              • -

                                                                                Feature: Update Socket to work around sending secure HTTPS responses with PHP < 7.1.4
                                                                                -(#244 by @clue)

                                                                                +

                                                                                Feature: Update Socket to work around sending secure HTTPS responses with PHP < 7.1.4
                                                                                +(#244 by @clue)

                                                                              • -

                                                                                Feature: Support sending same response header multiple times (e.g. Set-Cookie)
                                                                                -(#248 by @clue)

                                                                                +

                                                                                Feature: Support sending same response header multiple times (e.g. Set-Cookie)
                                                                                +(#248 by @clue)

                                                                              • -

                                                                                Feature: Raise maximum request header size to 8k to match common implementations
                                                                                -(#253 by @clue)

                                                                                +

                                                                                Feature: Raise maximum request header size to 8k to match common implementations
                                                                                +(#253 by @clue)

                                                                              • -

                                                                                Improve test suite by adding forward compatibility with PHPUnit 6, test
                                                                                +

                                                                                Improve test suite by adding forward compatibility with PHPUnit 6, test
                                                                                against PHP 7.1 and PHP 7.2 and refactor and remove risky and duplicate tests.
                                                                                -(#243, #269 and #270 by @carusogabriel and #249 by @clue)

                                                                                +(#243, #269 and #270 by @carusogabriel and #249 by @clue)

                                                                              • -

                                                                                Minor code refactoring to move internal classes to React\Http\Io namespace
                                                                                +

                                                                                Minor code refactoring to move internal classes to React\Http\Io namespace
                                                                                and clean up minor code and documentation issues
                                                                                -(#251 by @clue, #227 by @kalessil, #240 by @christoph-kluge, #230 by @jsor and #280 by @andig)

                                                                                +(#251 by @clue, #227 by @kalessil, #240 by @christoph-kluge, #230 by @jsor and #280 by @andig)

                                                                              @@ -5857,18 +1599,18 @@

                                                                              -
                                                                                +
                                                                                • -

                                                                                  Feature: Reject first() when stream emits an error event
                                                                                  -(#7 by @clue)

                                                                                  +

                                                                                  Feature: Reject first() when stream emits an error event
                                                                                  +(#7 by @clue)

                                                                                • -

                                                                                  Fix: Explicit close() of unwrapped stream should not emit error event
                                                                                  -(#8 by @clue)

                                                                                  +

                                                                                  Fix: Explicit close() of unwrapped stream should not emit error event
                                                                                  +(#8 by @clue)

                                                                                • -

                                                                                  Internal refactoring to simplify buffer() function
                                                                                  -(#6 by @kelunik)

                                                                                  +

                                                                                  Internal refactoring to simplify buffer() function
                                                                                  +(#6 by @kelunik)

                                                                                @@ -5887,23 +1629,23 @@

                                                                                -
                                                                                  +
                                                                                  • -

                                                                                    Fix: Igore excessive fopen() mode flags for WritableResourceStream
                                                                                    -(#119 by @clue)

                                                                                    +

                                                                                    Fix: Igore excessive fopen() mode flags for WritableResourceStream
                                                                                    +(#119 by @clue)

                                                                                  • -

                                                                                    Fix: Fix forward compatibility with upcoming EventLoop releases
                                                                                    -(#121 by @clue)

                                                                                    +

                                                                                    Fix: Fix forward compatibility with upcoming EventLoop releases
                                                                                    +(#121 by @clue)

                                                                                  • -

                                                                                    Restructure examples to ease getting started
                                                                                    -(#123 by @clue)

                                                                                    +

                                                                                    Restructure examples to ease getting started
                                                                                    +(#123 by @clue)

                                                                                  • -

                                                                                    Improve test suite by adding forward compatibility with PHPUnit 6 and
                                                                                    +

                                                                                    Improve test suite by adding forward compatibility with PHPUnit 6 and
                                                                                    ignore Mac OS X test failures for now until Travis tests work again
                                                                                    -(#122 by @Gabriel-Caruso and #120 by @clue)

                                                                                    +(#122 by @gabriel-caruso and #120 by @clue)

                                                                                  @@ -5922,25 +1664,25 @@

                                                                                  -
                                                                                    +
                                                                                    • -

                                                                                      Feature: Add Unix domain socket (UDS) support to Server with unix:// URI scheme
                                                                                      -and add advanced UnixServer class.
                                                                                      -(#120 by @andig)

                                                                                      -
                                                                                      // new: Server now supports "unix://" scheme
                                                                                      -$server = new Server('unix:///tmp/server.sock', $loop);
                                                                                      -
                                                                                      -// new: advanced usage
                                                                                      -$server = new UnixServer('/tmp/server.sock', $loop);
                                                                                      +

                                                                                      Feature: Add Unix domain socket (UDS) support to Server with unix:// URI scheme
                                                                                      +and add advanced UnixServer class.
                                                                                      +(#120 by @andig)

                                                                                      +
                                                                                      // new: Server now supports "unix://" scheme
                                                                                      +$server = new Server('unix:///tmp/server.sock', $loop);
                                                                                      +
                                                                                      +// new: advanced usage
                                                                                      +$server = new UnixServer('/tmp/server.sock', $loop);
                                                                                    • -

                                                                                      Restructure examples to ease getting started
                                                                                      -(#136 by @clue)

                                                                                      +

                                                                                      Restructure examples to ease getting started
                                                                                      +(#136 by @clue)

                                                                                    • -

                                                                                      Improve test suite by adding forward compatibility with PHPUnit 6 and
                                                                                      +

                                                                                      Improve test suite by adding forward compatibility with PHPUnit 6 and
                                                                                      ignore Mac OS X test failures for now until Travis tests work again
                                                                                      -(#133 by @Gabriel-Caruso and #134 by @clue)

                                                                                      +(#133 by @gabriel-caruso and #134 by @clue)

                                                                                    @@ -5959,11 +1701,11 @@

                                                                                    -
                                                                                      +
                                                                                      • First stable release, now following SemVer
                                                                                      -

                                                                                      Contains no other changes, so it's actually fully compatible with the v0.1.2 release.

                                                                                      +

                                                                                      Contains no other changes, so it's actually fully compatible with the v0.1.2 release.


                                                                                      @@ -5981,24 +1723,24 @@

                                                                                      -
                                                                                        +
                                                                                        • -

                                                                                          Fix: Work around PHP bug with Unix domain socket (UDS) paths for Mac OS X
                                                                                          -(#123 by @andig)

                                                                                          +

                                                                                          Fix: Work around PHP bug with Unix domain socket (UDS) paths for Mac OS X
                                                                                          +(#123 by @andig)

                                                                                        • -

                                                                                          Fix: Fix SecureServer to return null URI if server socket is already closed
                                                                                          -(#129 by @clue)

                                                                                          +

                                                                                          Fix: Fix SecureServer to return null URI if server socket is already closed
                                                                                          +(#129 by @clue)

                                                                                        • -

                                                                                          Improve test suite by adding forward compatibility with PHPUnit v5 and
                                                                                          +

                                                                                          Improve test suite by adding forward compatibility with PHPUnit v5 and
                                                                                          forward compatibility with upcoming EventLoop releases in tests and
                                                                                          test Mac OS X on Travis
                                                                                          -(#122 by @andig and #125, #127 and #130 by @clue)

                                                                                          +(#122 by @andig and #125, #127 and #130 by @clue)

                                                                                        • -

                                                                                          Readme improvements
                                                                                          -(#118 by @jsor)

                                                                                          +

                                                                                          Readme improvements
                                                                                          +(#118 by @jsor)

                                                                                        @@ -6017,9 +1759,9 @@

                                                                                        -
                                                                                          -
                                                                                        • Feature: Optional maximum buffer length for buffer() (#3 by @WyriHaximus)
                                                                                        • -
                                                                                        • Improvement: Readme improvements (#5 by @jsor)
                                                                                        • +
                                                                                            +
                                                                                          • Feature: Optional maximum buffer length for buffer() (#3 by @WyriHaximus)
                                                                                          • +
                                                                                          • Improvement: Readme improvements (#5 by @jsor)

                                                                                          @@ -6037,21 +1779,21 @@

                                                                                          -
                                                                                            +
                                                                                            • -

                                                                                              Fix: Remove event listeners from CompositeStream once closed and
                                                                                              -remove undocumented left-over close event argument
                                                                                              -(#116 by @clue)

                                                                                              +

                                                                                              Fix: Remove event listeners from CompositeStream once closed and
                                                                                              +remove undocumented left-over close event argument
                                                                                              +(#116 by @clue)

                                                                                            • -

                                                                                              Minor documentation improvements: Fix wrong class name in example,
                                                                                              +

                                                                                              Minor documentation improvements: Fix wrong class name in example,
                                                                                              fix typos in README and
                                                                                              fix forward compatibility with upcoming EventLoop releases in example
                                                                                              -(#113 by @docteurklein and #114 and #115 by @clue)

                                                                                              +(#113 by @docteurklein and #114 and #115 by @clue)

                                                                                            • -

                                                                                              Improve test suite by running against Mac OS X on Travis
                                                                                              -(#112 by @clue)

                                                                                              +

                                                                                              Improve test suite by running against Mac OS X on Travis
                                                                                              +(#112 by @clue)

                                                                                            @@ -6070,16 +1812,16 @@

                                                                                            -
                                                                                              +
                                                                                              • -

                                                                                                Feature: Always use Resolver with default DNS to match Socket component
                                                                                                +

                                                                                                Feature: Always use Resolver with default DNS to match Socket component
                                                                                                and update DNS dependency to support hosts file on all platforms
                                                                                                -(#19 and #20 by @clue)

                                                                                                -

                                                                                                This means that connecting to hosts such as localhost (and for example
                                                                                                +(#19 and #20 by @clue)

                                                                                                +

                                                                                                This means that connecting to hosts such as localhost (and for example
                                                                                                those used for Docker containers) will now work as expected across all
                                                                                                platforms with no changes required:

                                                                                                -
                                                                                                $factory = new Factory($loop);
                                                                                                -$factory->createClient('localhost:5353');
                                                                                                +
                                                                                                $factory = new Factory($loop);
                                                                                                +$factory->createClient('localhost:5353');
                                                                                              @@ -6088,7 +1830,7 @@

                                                                                              - HttpClient 0.5.6 + HTTPClient 0.5.6 (2017-09-17) @@ -6098,9 +1840,9 @@

                                                                                              -
                                                                                                +
                                                                                                • Feature: Update Socket component to support HTTP over Unix domain sockets (UDS)
                                                                                                  -(#110 by @clue)
                                                                                                • +(#110 by @clue)

                                                                                                @@ -6118,20 +1860,20 @@

                                                                                                -
                                                                                                  +
                                                                                                  • -

                                                                                                    Feature: Add FixedUriConnector decorator to use fixed, preconfigured URI instead
                                                                                                    -(#117 by @clue)

                                                                                                    -

                                                                                                    This can be useful for consumers that do not support certain URIs, such as
                                                                                                    +

                                                                                                    Feature: Add FixedUriConnector decorator to use fixed, preconfigured URI instead
                                                                                                    +(#117 by @clue)

                                                                                                    +

                                                                                                    This can be useful for consumers that do not support certain URIs, such as
                                                                                                    when you want to explicitly connect to a Unix domain socket (UDS) path
                                                                                                    instead of connecting to a default address assumed by an higher-level API:

                                                                                                    -
                                                                                                    $connector = new FixedUriConnector(
                                                                                                    -    'unix:///var/run/docker.sock',
                                                                                                    -    new UnixConnector($loop)
                                                                                                    -);
                                                                                                    -
                                                                                                    -// destination will be ignored, actually connects to Unix domain socket
                                                                                                    -$promise = $connector->connect('localhost:80');
                                                                                                    +
                                                                                                    $connector = new FixedUriConnector(
                                                                                                    +    'unix:///var/run/docker.sock',
                                                                                                    +    new UnixConnector($loop)
                                                                                                    +);
                                                                                                    +
                                                                                                    +// destination will be ignored, actually connects to Unix domain socket
                                                                                                    +$promise = $connector->connect('localhost:80');
                                                                                                  @@ -6140,7 +1882,7 @@

                                                                                                  - HttpClient 0.5.5 + HTTPClient 0.5.5 (2017-09-10) @@ -6150,9 +1892,9 @@

                                                                                                  -
                                                                                                    +
                                                                                                    • Fix: Update Socket component to work around sending secure HTTPS requests with PHP < 7.1.4
                                                                                                      -(#109 by @clue)
                                                                                                    • +(#109 by @clue)

                                                                                                    @@ -6170,14 +1912,14 @@

                                                                                                    -
                                                                                                      +
                                                                                                      • -

                                                                                                        Feature: Reduce memory consumption for failed connections
                                                                                                        -(#113 by @valga)

                                                                                                        +

                                                                                                        Feature: Reduce memory consumption for failed connections
                                                                                                        +(#113 by @valga)

                                                                                                      • -

                                                                                                        Fix: Work around write chunk size for TLS streams for PHP < 7.1.14
                                                                                                        -(#114 by @clue)

                                                                                                        +

                                                                                                        Fix: Work around write chunk size for TLS streams for PHP < 7.1.14
                                                                                                        +(#114 by @clue)

                                                                                                      @@ -6186,7 +1928,7 @@

                                                                                                      - HttpClient 0.5.4 + HTTPClient 0.5.4 (2017-08-25) @@ -6196,18 +1938,18 @@

                                                                                                      -
                                                                                                        +
                                                                                                        • -

                                                                                                          Feature: Update Socket dependency to support hosts file on all platforms
                                                                                                          -(#108 by @clue)

                                                                                                          -

                                                                                                          This means that HTTP requests to hosts such as localhost will now work as
                                                                                                          +

                                                                                                          Feature: Update Socket dependency to support hosts file on all platforms
                                                                                                          +(#108 by @clue)

                                                                                                          +

                                                                                                          This means that HTTP requests to hosts such as localhost will now work as
                                                                                                          expected across all platforms with no changes required:

                                                                                                          -
                                                                                                          $client = new Client($loop);
                                                                                                          -$request = $client->request('GET', 'http://localhost/');
                                                                                                          -$request->on('response', function (Response $response) {
                                                                                                          -    // …
                                                                                                          -});
                                                                                                          -$request->end();
                                                                                                          +
                                                                                                          $client = new Client($loop);
                                                                                                          +$request = $client->request('GET', 'http://localhost/');
                                                                                                          +$request->on('response', function (Response $response) {
                                                                                                          +    //
                                                                                                          +});
                                                                                                          +$request->end();
                                                                                                        @@ -6226,16 +1968,16 @@

                                                                                                        -
                                                                                                          +
                                                                                                          • -

                                                                                                            Feature: Update DNS dependency to support hosts file on all platforms
                                                                                                            -(#112 by @clue)

                                                                                                            -

                                                                                                            This means that connecting to hosts such as localhost will now work as
                                                                                                            +

                                                                                                            Feature: Update DNS dependency to support hosts file on all platforms
                                                                                                            +(#112 by @clue)

                                                                                                            +

                                                                                                            This means that connecting to hosts such as localhost will now work as
                                                                                                            expected across all platforms with no changes required:

                                                                                                            -
                                                                                                            $connector = new Connector($loop);
                                                                                                            -$connector->connect('localhost:8080')->then(function ($connection) {
                                                                                                            -    // …
                                                                                                            -});
                                                                                                            +
                                                                                                            $connector = new Connector($loop);
                                                                                                            +$connector->connect('localhost:8080')->then(function ($connection) {
                                                                                                            +    //
                                                                                                            +});
                                                                                                          @@ -6254,16 +1996,16 @@

                                                                                                          -
                                                                                                            +
                                                                                                            • -

                                                                                                              Feature: Support resolving from default hosts file
                                                                                                              -(#75, #76 and #77 by @clue)

                                                                                                              -

                                                                                                              This means that resolving hosts such as localhost will now work as
                                                                                                              +

                                                                                                              Feature: Support resolving from default hosts file
                                                                                                              +(#75, #76 and #77 by @clue)

                                                                                                              +

                                                                                                              This means that resolving hosts such as localhost will now work as
                                                                                                              expected across all platforms with no changes required:

                                                                                                              -
                                                                                                              $resolver->resolve('localhost')->then(function ($ip) {
                                                                                                              -    echo 'IP: ' . $ip;
                                                                                                              -});
                                                                                                              -

                                                                                                              The new HostsExecutor exists for advanced usage and is otherwise used
                                                                                                              +

                                                                                                              $resolver->resolve('localhost')->then(function ($ip) {
                                                                                                              +    echo 'IP: ' . $ip;
                                                                                                              +});
                                                                                                              +

                                                                                                              The new HostsExecutor exists for advanced usage and is otherwise used
                                                                                                              internally for this feature.

                                                                                                            @@ -6273,7 +2015,7 @@

                                                                                                            - HttpClient 0.5.3 + HTTPClient 0.5.3 (2017-08-16) @@ -6283,14 +2025,14 @@

                                                                                                            -
                                                                                                              +
                                                                                                              • -

                                                                                                                Feature: Target evenement 3.0 a long side 2.0
                                                                                                                -(#106 by @WyriHaximus)

                                                                                                                +

                                                                                                                Feature: Target evenement 3.0 a long side 2.0
                                                                                                                +(#106 by @WyriHaximus)

                                                                                                              • -

                                                                                                                Improve test suite by locking Travis distro so new defaults will not break the build
                                                                                                                -(#105 by @clue)

                                                                                                                +

                                                                                                                Improve test suite by locking Travis distro so new defaults will not break the build
                                                                                                                +(#105 by @clue)

                                                                                                              @@ -6309,9 +2051,9 @@

                                                                                                              -
                                                                                                                +
                                                                                                                @@ -6329,15 +2071,15 @@

                                                                                                                -
                                                                                                                  +
                                                                                                                  • Forward compatibility: react/event-loop 1.0 and 0.5, react/stream 0.7.2 and 1.0, and Événement 3.0
                                                                                                                    -(#38 and #44 by @WyriHaximus, and #46 by @clue)
                                                                                                                  • +(#38 and #44 by @WyriHaximus, and #46 by @clue)
                                                                                                                  • Windows compatibility: Documentate that windows isn't supported in 0.5 unless used from within WSL
                                                                                                                    -(#41 and #47 by @WyriHaximus)
                                                                                                                  • +(#41 and #47 by @WyriHaximus)
                                                                                                                  • Documentation: Termination examples
                                                                                                                    -(#42 by @clue)
                                                                                                                  • -
                                                                                                                  • BC: Throw LogicException in Process instanciating when on Windows or when proc_open is missing (was RuntimeException)
                                                                                                                    -(#49 by @mdrost)
                                                                                                                  • +(#42 by @clue) +
                                                                                                                  • BC: Throw LogicException in Process instanciating when on Windows or when proc_open is missing (was RuntimeException)
                                                                                                                    +(#49 by @mdrost)

                                                                                                                  @@ -6355,20 +2097,20 @@

                                                                                                                  -
                                                                                                                    +
                                                                                                                    • -

                                                                                                                      Feature: Forward compatibility with upcoming EventLoop v1.0 and v0.5 and
                                                                                                                      +

                                                                                                                      Feature: Forward compatibility with upcoming EventLoop v1.0 and v0.5 and
                                                                                                                      target evenement 3.0 a long side 2.0 and 1.0
                                                                                                                      -(#104 by @clue and #111 by @WyriHaximus)

                                                                                                                      +(#104 by @clue and #111 by @WyriHaximus)

                                                                                                                    • -

                                                                                                                      Improve test suite by locking Travis distro so new defaults will not break the build and
                                                                                                                      +

                                                                                                                      Improve test suite by locking Travis distro so new defaults will not break the build and
                                                                                                                      fix HHVM build for now again and ignore future HHVM build errors
                                                                                                                      -(#109 and #110 by @clue)

                                                                                                                      +(#109 and #110 by @clue)

                                                                                                                    • -

                                                                                                                      Minor documentation fixes
                                                                                                                      -(#103 by @christiaan and #108 by @hansott)

                                                                                                                      +

                                                                                                                      Minor documentation fixes
                                                                                                                      +(#103 by @christiaan and #108 by @hansott)

                                                                                                                    @@ -6387,19 +2129,19 @@

                                                                                                                    -
                                                                                                                      +
                                                                                                                      • -

                                                                                                                        Feature: Support Throwable when setting previous exception from server callback
                                                                                                                        -(#155 by @jsor)

                                                                                                                        +

                                                                                                                        Feature: Support Throwable when setting previous exception from server callback
                                                                                                                        +(#155 by @jsor)

                                                                                                                      • -

                                                                                                                        Fix: Fixed URI parsing for origin-form requests that contain scheme separator
                                                                                                                        -such as /path?param=http://example.com.
                                                                                                                        -(#209 by @aaronbonneau)

                                                                                                                        +

                                                                                                                        Fix: Fixed URI parsing for origin-form requests that contain scheme separator
                                                                                                                        +such as /path?param=http://example.com.
                                                                                                                        +(#209 by @aaronbonneau)

                                                                                                                      • -

                                                                                                                        Improve test suite by locking Travis distro so new defaults will not break the build
                                                                                                                        -(#211 by @clue)

                                                                                                                        +

                                                                                                                        Improve test suite by locking Travis distro so new defaults will not break the build
                                                                                                                        +(#211 by @clue)

                                                                                                                      @@ -6418,29 +2160,29 @@

                                                                                                                      -
                                                                                                                        +
                                                                                                                        • -

                                                                                                                          Feature: Forward compatibility with EventLoop v1.0 and v0.5 and
                                                                                                                          +

                                                                                                                          Feature: Forward compatibility with EventLoop v1.0 and v0.5 and
                                                                                                                          lock minimum dependencies and work around circular dependency for tests
                                                                                                                          -(#70 and #71 by @clue)

                                                                                                                          +(#70 and #71 by @clue)

                                                                                                                        • -

                                                                                                                          Fix: Work around DNS timeout issues for Windows users
                                                                                                                          -(#74 by @clue)

                                                                                                                          +

                                                                                                                          Fix: Work around DNS timeout issues for Windows users
                                                                                                                          +(#74 by @clue)

                                                                                                                        • -

                                                                                                                          Documentation and examples for advanced usage
                                                                                                                          -(#66 by @WyriHaximus)

                                                                                                                          +

                                                                                                                          Documentation and examples for advanced usage
                                                                                                                          +(#66 by @WyriHaximus)

                                                                                                                        • -

                                                                                                                          Remove broken TCP code, do not retry with invalid TCP query
                                                                                                                          -(#73 by @clue)

                                                                                                                          +

                                                                                                                          Remove broken TCP code, do not retry with invalid TCP query
                                                                                                                          +(#73 by @clue)

                                                                                                                        • -

                                                                                                                          Improve test suite by fixing HHVM build for now again and ignore future HHVM build errors and
                                                                                                                          +

                                                                                                                          Improve test suite by fixing HHVM build for now again and ignore future HHVM build errors and
                                                                                                                          lock Travis distro so new defaults will not break the build and
                                                                                                                          fix failing tests for PHP 7.1
                                                                                                                          -(#68 by @WyriHaximus and #69 and #72 by @clue)

                                                                                                                          +(#68 by @WyriHaximus and #69 and #72 by @clue)

                                                                                                                        @@ -6459,18 +2201,18 @@

                                                                                                                        -
                                                                                                                          +
                                                                                                                          • -

                                                                                                                            Feature: Target evenement 3.0 a long side 2.0 and 1.0
                                                                                                                            -(#16 by @WyriHaximus)

                                                                                                                            +

                                                                                                                            Feature: Target evenement 3.0 a long side 2.0 and 1.0
                                                                                                                            +(#16 by @WyriHaximus)

                                                                                                                          • -

                                                                                                                            Feature: Forward compatibility with EventLoop v1.0 and v0.5
                                                                                                                            -(#18 by @clue)

                                                                                                                            +

                                                                                                                            Feature: Forward compatibility with EventLoop v1.0 and v0.5
                                                                                                                            +(#18 by @clue)

                                                                                                                          • -

                                                                                                                            Improve test suite by updating Travis build config so new defaults do not break the build
                                                                                                                            -(#17 by @clue)

                                                                                                                            +

                                                                                                                            Improve test suite by updating Travis build config so new defaults do not break the build
                                                                                                                            +(#17 by @clue)

                                                                                                                          @@ -6489,24 +2231,24 @@

                                                                                                                          -
                                                                                                                            +
                                                                                                                            • -

                                                                                                                              Feature: Only start timers if input Promise is still pending and
                                                                                                                              +

                                                                                                                              Feature: Only start timers if input Promise is still pending and
                                                                                                                              return a settled output promise if the input is already settled.
                                                                                                                              -(#25 by @clue)

                                                                                                                              +(#25 by @clue)

                                                                                                                            • -

                                                                                                                              Feature: Cap minimum timer interval at 1µs across all versions
                                                                                                                              -(#23 by @clue)

                                                                                                                              +

                                                                                                                              Feature: Cap minimum timer interval at 1µs across all versions
                                                                                                                              +(#23 by @clue)

                                                                                                                            • -

                                                                                                                              Feature: Forward compatibility with EventLoop v1.0 and v0.5
                                                                                                                              -(#27 by @clue)

                                                                                                                              +

                                                                                                                              Feature: Forward compatibility with EventLoop v1.0 and v0.5
                                                                                                                              +(#27 by @clue)

                                                                                                                            • -

                                                                                                                              Improve test suite by adding PHPUnit to require-dev and
                                                                                                                              +

                                                                                                                              Improve test suite by adding PHPUnit to require-dev and
                                                                                                                              lock Travis distro so new defaults will not break the build
                                                                                                                              -(#24 and #26 by @clue)

                                                                                                                              +(#24 and #26 by @clue)

                                                                                                                            @@ -6525,13 +2267,13 @@

                                                                                                                            -
                                                                                                                              +
                                                                                                                              @@ -6549,14 +2291,14 @@

                                                                                                                              -
                                                                                                                                +
                                                                                                                                • -

                                                                                                                                  Fix: Stricter check for invalid request-line in HTTP requests
                                                                                                                                  -(#206 by @clue)

                                                                                                                                  +

                                                                                                                                  Fix: Stricter check for invalid request-line in HTTP requests
                                                                                                                                  +(#206 by @clue)

                                                                                                                                • -

                                                                                                                                  Refactor to use HTTP response reason phrases from response object
                                                                                                                                  -(#205 by @clue)

                                                                                                                                  +

                                                                                                                                  Refactor to use HTTP response reason phrases from response object
                                                                                                                                  +(#205 by @clue)

                                                                                                                                @@ -6565,7 +2307,7 @@

                                                                                                                                - HttpClient 0.5.2 + HTTPClient 0.5.2 (2017-06-27) @@ -6575,14 +2317,14 @@

                                                                                                                                -
                                                                                                                                  +
                                                                                                                                  • -

                                                                                                                                    Feature: Support passing arrays for request header values
                                                                                                                                    -(#100 by @clue)

                                                                                                                                    +

                                                                                                                                    Feature: Support passing arrays for request header values
                                                                                                                                    +(#100 by @clue)

                                                                                                                                  • -

                                                                                                                                    Fix: Fix merging default headers if overwritten with custom case headers
                                                                                                                                    -(#101 by @clue)

                                                                                                                                    +

                                                                                                                                    Fix: Fix merging default headers if overwritten with custom case headers
                                                                                                                                    +(#101 by @clue)

                                                                                                                                  @@ -6591,7 +2333,7 @@

                                                                                                                                  - HttpClient 0.5.1 + HTTPClient 0.5.1 (2017-06-18) @@ -6601,18 +2343,18 @@

                                                                                                                                  -
                                                                                                                                    +
                                                                                                                                    • -

                                                                                                                                      Feature: Emit error event if request URL is invalid
                                                                                                                                      -(#99 by @clue)

                                                                                                                                      +

                                                                                                                                      Feature: Emit error event if request URL is invalid
                                                                                                                                      +(#99 by @clue)

                                                                                                                                    • -

                                                                                                                                      Feature: Support OPTIONS method with asterisk-form (OPTIONS * HTTP/1.1)
                                                                                                                                      -(#98 by @clue)

                                                                                                                                      +

                                                                                                                                      Feature: Support OPTIONS method with asterisk-form (OPTIONS * HTTP/1.1)
                                                                                                                                      +(#98 by @clue)

                                                                                                                                    • -

                                                                                                                                      Improve documentation for event semantics
                                                                                                                                      -(#97 by @clue)

                                                                                                                                      +

                                                                                                                                      Improve documentation for event semantics
                                                                                                                                      +(#97 by @clue)

                                                                                                                                    @@ -6631,14 +2373,14 @@

                                                                                                                                    -
                                                                                                                                      +
                                                                                                                                      • -

                                                                                                                                        Fix: Fix parsing CONNECT request without Host header
                                                                                                                                        -(#201 by @clue)

                                                                                                                                        +

                                                                                                                                        Fix: Fix parsing CONNECT request without Host header
                                                                                                                                        +(#201 by @clue)

                                                                                                                                      • -

                                                                                                                                        Internal preparation for future PSR-7 UploadedFileInterface
                                                                                                                                        -(#199 by @WyriHaximus)

                                                                                                                                        +

                                                                                                                                        Internal preparation for future PSR-7 UploadedFileInterface
                                                                                                                                        +(#199 by @WyriHaximus)

                                                                                                                                      @@ -6657,9 +2399,9 @@

                                                                                                                                      -
                                                                                                                                        +
                                                                                                                                        @@ -6677,79 +2419,79 @@

                                                                                                                                        -
                                                                                                                                          +
                                                                                                                                          • -

                                                                                                                                            Feature / BC break: Use PSR-7 (http-message) standard and
                                                                                                                                            -Request-In-Response-Out-style request handler callback.
                                                                                                                                            -Pass standard PSR-7 ServerRequestInterface and expect any standard
                                                                                                                                            -PSR-7 ResponseInterface in return for the request handler callback.
                                                                                                                                            -(#146 and #152 and #170 by @legionth)

                                                                                                                                            -
                                                                                                                                            // old
                                                                                                                                            -$app = function (Request $request, Response $response) {
                                                                                                                                            -    $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                            -    $response->end("Hello world!\n");
                                                                                                                                            -};
                                                                                                                                            -
                                                                                                                                            -// new
                                                                                                                                            -$app = function (ServerRequestInterface $request) {
                                                                                                                                            -    return new Response(
                                                                                                                                            -        200,
                                                                                                                                            -        array('Content-Type' => 'text/plain'),
                                                                                                                                            -        "Hello world!\n"
                                                                                                                                            -    );
                                                                                                                                            -};
                                                                                                                                            -

                                                                                                                                            A Content-Length header will automatically be included if the size can be
                                                                                                                                            +

                                                                                                                                            Feature / BC break: Use PSR-7 (http-message) standard and
                                                                                                                                            +Request-In-Response-Out-style request handler callback.
                                                                                                                                            +Pass standard PSR-7 ServerRequestInterface and expect any standard
                                                                                                                                            +PSR-7 ResponseInterface in return for the request handler callback.
                                                                                                                                            +(#146 and #152 and #170 by @legionth)

                                                                                                                                            +
                                                                                                                                            // old
                                                                                                                                            +$app = function (Request $request, Response $response) {
                                                                                                                                            +    $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                            +    $response->end("Hello world!\n");
                                                                                                                                            +};
                                                                                                                                            +
                                                                                                                                            +// new
                                                                                                                                            +$app = function (ServerRequestInterface $request) {
                                                                                                                                            +    return new Response(
                                                                                                                                            +        200,
                                                                                                                                            +        array('Content-Type' => 'text/plain'),
                                                                                                                                            +        "Hello world!\n"
                                                                                                                                            +    );
                                                                                                                                            +};
                                                                                                                                            +

                                                                                                                                            A Content-Length header will automatically be included if the size can be
                                                                                                                                            determined from the response body.
                                                                                                                                            -(#164 by @maciejmrozinski)

                                                                                                                                            -

                                                                                                                                            The request handler callback will automatically make sure that responses to
                                                                                                                                            -HEAD requests and certain status codes, such as 204 (No Content), never
                                                                                                                                            +(#164 by @maciejmrozinski)

                                                                                                                                            +

                                                                                                                                            The request handler callback will automatically make sure that responses to
                                                                                                                                            +HEAD requests and certain status codes, such as 204 (No Content), never
                                                                                                                                            contain a response body.
                                                                                                                                            -(#156 by @clue)

                                                                                                                                            -

                                                                                                                                            The intermediary 100 Continue response will automatically be sent if
                                                                                                                                            +(#156 by @clue)

                                                                                                                                            +

                                                                                                                                            The intermediary 100 Continue response will automatically be sent if
                                                                                                                                            demanded by a HTTP/1.1 client.
                                                                                                                                            -(#144 by @legionth)

                                                                                                                                            -

                                                                                                                                            The request handler callback can now return a standard Promise if
                                                                                                                                            +(#144 by @legionth)

                                                                                                                                            +

                                                                                                                                            The request handler callback can now return a standard Promise if
                                                                                                                                            processing the request needs some time, such as when querying a database.
                                                                                                                                            Similarly, the request handler may return a streaming response if the
                                                                                                                                            -response body comes from a ReadableStreamInterface or its size is
                                                                                                                                            +response body comes from a ReadableStreamInterface or its size is
                                                                                                                                            unknown in advance.

                                                                                                                                            -
                                                                                                                                            // old
                                                                                                                                            -$app = function (Request $request, Response $response) use ($db) {
                                                                                                                                            -    $db->query()->then(function ($result) use ($response) {
                                                                                                                                            -        $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                            -        $response->end($result);
                                                                                                                                            -    });
                                                                                                                                            -};
                                                                                                                                            -
                                                                                                                                            -// new
                                                                                                                                            -$app = function (ServerRequestInterface $request) use ($db) {
                                                                                                                                            -    return $db->query()->then(function ($result) {
                                                                                                                                            -        return new Response(
                                                                                                                                            -            200,
                                                                                                                                            -            array('Content-Type' => 'text/plain'),
                                                                                                                                            -            $result
                                                                                                                                            -        );
                                                                                                                                            -    });
                                                                                                                                            -};
                                                                                                                                            -

                                                                                                                                            Pending promies and response streams will automatically be canceled once the
                                                                                                                                            +

                                                                                                                                            // old
                                                                                                                                            +$app = function (Request $request, Response $response) use ($db) {
                                                                                                                                            +    $db->query()->then(function ($result) use ($response) {
                                                                                                                                            +        $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                            +        $response->end($result);
                                                                                                                                            +    });
                                                                                                                                            +};
                                                                                                                                            +
                                                                                                                                            +// new
                                                                                                                                            +$app = function (ServerRequestInterface $request) use ($db) {
                                                                                                                                            +    return $db->query()->then(function ($result) {
                                                                                                                                            +        return new Response(
                                                                                                                                            +            200,
                                                                                                                                            +            array('Content-Type' => 'text/plain'),
                                                                                                                                            +            $result
                                                                                                                                            +        );
                                                                                                                                            +    });
                                                                                                                                            +};
                                                                                                                                            +

                                                                                                                                            Pending promies and response streams will automatically be canceled once the
                                                                                                                                            client connection closes.
                                                                                                                                            -(#187 and #188 by @clue)

                                                                                                                                            -

                                                                                                                                            The ServerRequestInterface contains the full effective request URI,
                                                                                                                                            +(#187 and #188 by @clue)

                                                                                                                                            +

                                                                                                                                            The ServerRequestInterface contains the full effective request URI,
                                                                                                                                            server-side parameters, query parameters and parsed cookies values as
                                                                                                                                            defined in PSR-7.
                                                                                                                                            -(#167 by @clue and #174, #175 and #180 by @legionth)

                                                                                                                                            -
                                                                                                                                            $app = function (ServerRequestInterface $request) {
                                                                                                                                            -    return new Response(
                                                                                                                                            -        200,
                                                                                                                                            -        array('Content-Type' => 'text/plain'),
                                                                                                                                            -        $request->getUri()->getScheme()
                                                                                                                                            -    );
                                                                                                                                            -};
                                                                                                                                            -

                                                                                                                                            Advanced: Support duplex stream response for Upgrade requests such as
                                                                                                                                            -Upgrade: WebSocket or custom protocols and CONNECT requests
                                                                                                                                            -(#189 and #190 by @clue)

                                                                                                                                            +(#167 by @clue and #174, #175 and #180 by @legionth)

                                                                                                                                            +
                                                                                                                                            $app = function (ServerRequestInterface $request) {
                                                                                                                                            +    return new Response(
                                                                                                                                            +        200,
                                                                                                                                            +        array('Content-Type' => 'text/plain'),
                                                                                                                                            +        $request->getUri()->getScheme()
                                                                                                                                            +    );
                                                                                                                                            +};
                                                                                                                                            +

                                                                                                                                            Advanced: Support duplex stream response for Upgrade requests such as
                                                                                                                                            +Upgrade: WebSocket or custom protocols and CONNECT requests
                                                                                                                                            +(#189 and #190 by @clue)

                                                                                                                                            -

                                                                                                                                            Note that the request body will currently not be buffered and parsed by
                                                                                                                                            +

                                                                                                                                            Note that the request body will currently not be buffered and parsed by
                                                                                                                                            default, which depending on your particilar use-case, may limit
                                                                                                                                            interoperability with the PSR-7 (http-message) ecosystem.
                                                                                                                                            The provided streaming request body interfaces allow you to perform
                                                                                                                                            @@ -6758,39 +2500,39 @@

                                                                                                                                          • -

                                                                                                                                            Feature / BC break: Replace request listener with callback function and
                                                                                                                                            -use listen() method to support multiple listening sockets
                                                                                                                                            -(#97 by @legionth and #193 by @clue)

                                                                                                                                            -
                                                                                                                                            // old
                                                                                                                                            -$server = new Server($socket);
                                                                                                                                            -$server->on('request', $app);
                                                                                                                                            -
                                                                                                                                            -// new
                                                                                                                                            -$server = new Server($app);
                                                                                                                                            -$server->listen($socket);
                                                                                                                                            +

                                                                                                                                            Feature / BC break: Replace request listener with callback function and
                                                                                                                                            +use listen() method to support multiple listening sockets
                                                                                                                                            +(#97 by @legionth and #193 by @clue)

                                                                                                                                            +
                                                                                                                                            // old
                                                                                                                                            +$server = new Server($socket);
                                                                                                                                            +$server->on('request', $app);
                                                                                                                                            +
                                                                                                                                            +// new
                                                                                                                                            +$server = new Server($app);
                                                                                                                                            +$server->listen($socket);
                                                                                                                                          • -

                                                                                                                                            Feature: Support the more advanced HTTP requests, such as
                                                                                                                                            -OPTIONS * HTTP/1.1 (OPTIONS method in asterisk-form),
                                                                                                                                            -GET http://example.com/path HTTP/1.1 (plain proxy requests in absolute-form),
                                                                                                                                            -CONNECT example.com:443 HTTP/1.1 (CONNECT proxy requests in authority-form)
                                                                                                                                            -and sanitize Host header value across all requests.
                                                                                                                                            -(#157, #158, #161, #165, #169 and #173 by @clue)

                                                                                                                                            +

                                                                                                                                            Feature: Support the more advanced HTTP requests, such as
                                                                                                                                            +OPTIONS * HTTP/1.1 (OPTIONS method in asterisk-form),
                                                                                                                                            +GET http://example.com/path HTTP/1.1 (plain proxy requests in absolute-form),
                                                                                                                                            +CONNECT example.com:443 HTTP/1.1 (CONNECT proxy requests in authority-form)
                                                                                                                                            +and sanitize Host header value across all requests.
                                                                                                                                            +(#157, #158, #161, #165, #169 and #173 by @clue)

                                                                                                                                          • -

                                                                                                                                            Feature: Forward compatibility with Socket v1.0, v0.8, v0.7 and v0.6 and
                                                                                                                                            +

                                                                                                                                            Feature: Forward compatibility with Socket v1.0, v0.8, v0.7 and v0.6 and
                                                                                                                                            forward compatibility with Stream v1.0 and v0.7
                                                                                                                                            -(#154, #163, #183, #184 and #191 by @clue)

                                                                                                                                            +(#154, #163, #183, #184 and #191 by @clue)

                                                                                                                                          • -

                                                                                                                                            Feature: Simplify examples to ease getting started and
                                                                                                                                            +

                                                                                                                                            Feature: Simplify examples to ease getting started and
                                                                                                                                            add benchmarking example
                                                                                                                                            -(#151 and #162 by @clue)

                                                                                                                                            +(#151 and #162 by @clue)

                                                                                                                                          • -

                                                                                                                                            Improve test suite by adding tests for case insensitive chunked transfer
                                                                                                                                            +

                                                                                                                                            Improve test suite by adding tests for case insensitive chunked transfer
                                                                                                                                            encoding and ignoring HHVM test failures until Travis tests work again.
                                                                                                                                            -(#150 by @legionth and #185 by @clue)

                                                                                                                                            +(#150 by @legionth and #185 by @clue)

                                                                                                                                          @@ -6799,7 +2541,7 @@

                                                                                                                                          - HttpClient 0.5.0 + HTTPClient 0.5.0 (2017-05-22) @@ -6809,41 +2551,41 @@

                                                                                                                                          -
                                                                                                                                            +
                                                                                                                                            • -

                                                                                                                                              Feature / BC break: Replace Factory with simple Client constructor
                                                                                                                                              -(#85 by @clue)

                                                                                                                                              -

                                                                                                                                              The Client now accepts a required LoopInterface and an optional
                                                                                                                                              -ConnectorInterface. It will now create a default Connector if none
                                                                                                                                              +

                                                                                                                                              Feature / BC break: Replace Factory with simple Client constructor
                                                                                                                                              +(#85 by @clue)

                                                                                                                                              +

                                                                                                                                              The Client now accepts a required LoopInterface and an optional
                                                                                                                                              +ConnectorInterface. It will now create a default Connector if none
                                                                                                                                              has been given.

                                                                                                                                              -
                                                                                                                                              // old
                                                                                                                                              -$dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                              -$dnsResolver = $dnsResolverFactory->createCached('8.8.8.8', $loop);
                                                                                                                                              -$factory = new React\HttpClient\Factory();
                                                                                                                                              -$client = $factory->create($loop, $dnsResolver);
                                                                                                                                              -
                                                                                                                                              -// new
                                                                                                                                              -$client = new React\HttpClient\Client($loop);
                                                                                                                                              +
                                                                                                                                              // old
                                                                                                                                              +$dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                              +$dnsResolver = $dnsResolverFactory->createCached('8.8.8.8', $loop);
                                                                                                                                              +$factory = new React\HttpClient\Factory();
                                                                                                                                              +$client = $factory->create($loop, $dnsResolver);
                                                                                                                                              +
                                                                                                                                              +// new
                                                                                                                                              +$client = new React\HttpClient\Client($loop);
                                                                                                                                            • -

                                                                                                                                              Feature: Request::close() now cancels pending connection attempt
                                                                                                                                              -(#91 by @clue)

                                                                                                                                              +

                                                                                                                                              Feature: Request::close() now cancels pending connection attempt
                                                                                                                                              +(#91 by @clue)

                                                                                                                                            • -

                                                                                                                                              Feature / BC break: Replace deprecated SocketClient with new Socket component
                                                                                                                                              -(#74, #84 and #88 by @clue)

                                                                                                                                              +

                                                                                                                                              Feature / BC break: Replace deprecated SocketClient with new Socket component
                                                                                                                                              +(#74, #84 and #88 by @clue)

                                                                                                                                            • -

                                                                                                                                              Feature / BC break: Consistent stream semantics and forward compatibility with upcoming Stream v1.0
                                                                                                                                              -(#90 by @clue)

                                                                                                                                              +

                                                                                                                                              Feature / BC break: Consistent stream semantics and forward compatibility with upcoming Stream v1.0
                                                                                                                                              +(#90 by @clue)

                                                                                                                                            • -

                                                                                                                                              Feature: Forward compatibility with upcoming EventLoop v1.0 and v0.5
                                                                                                                                              -(#89 by @clue)

                                                                                                                                              +

                                                                                                                                              Feature: Forward compatibility with upcoming EventLoop v1.0 and v0.5
                                                                                                                                              +(#89 by @clue)

                                                                                                                                            • -

                                                                                                                                              Fix: Catch Guzzle parser exception
                                                                                                                                              -(#82 by @djagya)

                                                                                                                                              +

                                                                                                                                              Fix: Catch Guzzle parser exception
                                                                                                                                              +(#82 by @djagya)

                                                                                                                                            @@ -6862,16 +2604,16 @@

                                                                                                                                            -
                                                                                                                                              +
                                                                                                                                              • -

                                                                                                                                                Feature: Add optional $writeChunkSize parameter to limit maximum number of
                                                                                                                                                +

                                                                                                                                                Feature: Add optional $writeChunkSize parameter to limit maximum number of
                                                                                                                                                bytes to write at once.
                                                                                                                                                -(#105 by @clue)

                                                                                                                                                -
                                                                                                                                                $stream = new WritableResourceStream(STDOUT, $loop, null, 8192);
                                                                                                                                                +(#105 by @clue)

                                                                                                                                                +
                                                                                                                                                $stream = new WritableResourceStream(STDOUT, $loop, null, 8192);
                                                                                                                                              • -

                                                                                                                                                Ignore HHVM test failures for now until Travis tests work again
                                                                                                                                                -(#106 by @clue)

                                                                                                                                                +

                                                                                                                                                Ignore HHVM test failures for now until Travis tests work again
                                                                                                                                                +(#106 by @clue)

                                                                                                                                              @@ -6890,8 +2632,8 @@

                                                                                                                                              -
                                                                                                                                                -
                                                                                                                                              • Improvement: Forward compatibility with stream 1.0, 0.7, 0.6, and 0.5 (#2 by @WyriHaximus)
                                                                                                                                              • +
                                                                                                                                                  +
                                                                                                                                                • Improvement: Forward compatibility with stream 1.0, 0.7, 0.6, and 0.5 (#2 by @WyriHaximus)

                                                                                                                                                @@ -6909,8 +2651,8 @@

                                                                                                                                                -
                                                                                                                                                  -
                                                                                                                                                • Initial release, adapted from clue/promise-stream-react
                                                                                                                                                • +
                                                                                                                                                  @@ -6928,31 +2670,31 @@

                                                                                                                                                  -
                                                                                                                                                    +
                                                                                                                                                    • -

                                                                                                                                                      Feature: New Server class now acts as a facade for existing server classes
                                                                                                                                                      -and renamed old Server to TcpServer for advanced usage.
                                                                                                                                                      -(#96 and #97 by @clue)

                                                                                                                                                      -

                                                                                                                                                      The Server class is now the main class in this package that implements the
                                                                                                                                                      -ServerInterface and allows you to accept incoming streaming connections,
                                                                                                                                                      +

                                                                                                                                                      Feature: New Server class now acts as a facade for existing server classes
                                                                                                                                                      +and renamed old Server to TcpServer for advanced usage.
                                                                                                                                                      +(#96 and #97 by @clue)

                                                                                                                                                      +

                                                                                                                                                      The Server class is now the main class in this package that implements the
                                                                                                                                                      +ServerInterface and allows you to accept incoming streaming connections,
                                                                                                                                                      such as plaintext TCP/IP or secure TLS connection streams.

                                                                                                                                                      -

                                                                                                                                                      This is not a BC break and consumer code does not have to be updated.

                                                                                                                                                      +

                                                                                                                                                      This is not a BC break and consumer code does not have to be updated.

                                                                                                                                                    • -

                                                                                                                                                      Feature / BC break: All addresses are now URIs that include the URI scheme
                                                                                                                                                      -(#98 by @clue)

                                                                                                                                                      -
                                                                                                                                                      - $parts = parse_url('tcp://' . $conn->getRemoteAddress());
                                                                                                                                                      +

                                                                                                                                                      Feature / BC break: All addresses are now URIs that include the URI scheme
                                                                                                                                                      +(#98 by @clue)

                                                                                                                                                      +
                                                                                                                                                      - $parts = parse_url('tcp://' . $conn->getRemoteAddress());
                                                                                                                                                       + $parts = parse_url($conn->getRemoteAddress());
                                                                                                                                                    • -

                                                                                                                                                      Fix: Fix unix:// addresses for Unix domain socket (UDS) paths
                                                                                                                                                      -(#100 by @clue)

                                                                                                                                                      +

                                                                                                                                                      Fix: Fix unix:// addresses for Unix domain socket (UDS) paths
                                                                                                                                                      +(#100 by @clue)

                                                                                                                                                    • -

                                                                                                                                                      Feature: Forward compatibility with Stream v1.0 and v0.7
                                                                                                                                                      -(#99 by @clue)

                                                                                                                                                      +

                                                                                                                                                      Feature: Forward compatibility with Stream v1.0 and v0.7
                                                                                                                                                      +(#99 by @clue)

                                                                                                                                                    @@ -6971,78 +2713,78 @@

                                                                                                                                                    -
                                                                                                                                                      +
                                                                                                                                                      • -

                                                                                                                                                        Removed / BC break: Remove deprecated and unneeded functionality
                                                                                                                                                        -(#45, #87, #90, #91 and #93 by @clue)

                                                                                                                                                        -
                                                                                                                                                          +

                                                                                                                                                          Removed / BC break: Remove deprecated and unneeded functionality
                                                                                                                                                          +(#45, #87, #90, #91 and #93 by @clue)

                                                                                                                                                          +
                                                                                                                                                          • -

                                                                                                                                                            Remove deprecated Stream class, use DuplexResourceStream instead
                                                                                                                                                            -(#87 by @clue)

                                                                                                                                                            +

                                                                                                                                                            Remove deprecated Stream class, use DuplexResourceStream instead
                                                                                                                                                            +(#87 by @clue)

                                                                                                                                                          • -

                                                                                                                                                            Remove public $buffer property, use new constructor parameters instead
                                                                                                                                                            -(#91 by @clue)

                                                                                                                                                            +

                                                                                                                                                            Remove public $buffer property, use new constructor parameters instead
                                                                                                                                                            +(#91 by @clue)

                                                                                                                                                          • -

                                                                                                                                                            Remove public $stream property from all resource streams
                                                                                                                                                            -(#90 by @clue)

                                                                                                                                                            +

                                                                                                                                                            Remove public $stream property from all resource streams
                                                                                                                                                            +(#90 by @clue)

                                                                                                                                                          • -

                                                                                                                                                            Remove undocumented and now unused ReadableStream and WritableStream
                                                                                                                                                            -(#93 by @clue)

                                                                                                                                                            +

                                                                                                                                                            Remove undocumented and now unused ReadableStream and WritableStream
                                                                                                                                                            +(#93 by @clue)

                                                                                                                                                          • -

                                                                                                                                                            Remove BufferedSink
                                                                                                                                                            -(#45 by @clue)

                                                                                                                                                            +

                                                                                                                                                            Remove BufferedSink
                                                                                                                                                            +(#45 by @clue)

                                                                                                                                                        • -

                                                                                                                                                          Feature / BC break: Simplify ThroughStream by using data callback instead of
                                                                                                                                                          -inheritance. It is now a direct implementation of DuplexStreamInterface.
                                                                                                                                                          -(#88 and #89 by @clue)

                                                                                                                                                          -
                                                                                                                                                          $through = new ThroughStream(function ($data) {
                                                                                                                                                          -    return json_encode($data) . PHP_EOL;
                                                                                                                                                          -});
                                                                                                                                                          -$through->on('data', $this->expectCallableOnceWith("[2, true]\n"));
                                                                                                                                                          -
                                                                                                                                                          -$through->write(array(2, true));
                                                                                                                                                          +

                                                                                                                                                          Feature / BC break: Simplify ThroughStream by using data callback instead of
                                                                                                                                                          +inheritance. It is now a direct implementation of DuplexStreamInterface.
                                                                                                                                                          +(#88 and #89 by @clue)

                                                                                                                                                          +
                                                                                                                                                          $through = new ThroughStream(function ($data) {
                                                                                                                                                          +    return json_encode($data) . PHP_EOL;
                                                                                                                                                          +});
                                                                                                                                                          +$through->on('data', $this->expectCallableOnceWith("[2, true]\n"));
                                                                                                                                                          +
                                                                                                                                                          +$through->write(array(2, true));
                                                                                                                                                        • -

                                                                                                                                                          Feature / BC break: The CompositeStream starts closed if either side is
                                                                                                                                                          +

                                                                                                                                                          Feature / BC break: The CompositeStream starts closed if either side is
                                                                                                                                                          already closed and forwards pause to pipe source on first write attempt.
                                                                                                                                                          -(#96 and #103 by @clue)

                                                                                                                                                          -

                                                                                                                                                          If either side of the composite stream closes, it will also close the other
                                                                                                                                                          +(#96 and #103 by @clue)

                                                                                                                                                          +

                                                                                                                                                          If either side of the composite stream closes, it will also close the other
                                                                                                                                                          side. We now also ensure that if either side is already closed during
                                                                                                                                                          instantiation, it will also close the other side.

                                                                                                                                                        • -

                                                                                                                                                          BC break: Mark all classes as final and
                                                                                                                                                          -mark internal API as private to discourage inheritance
                                                                                                                                                          -(#95 and #99 by @clue)

                                                                                                                                                          +

                                                                                                                                                          BC break: Mark all classes as final and
                                                                                                                                                          +mark internal API as private to discourage inheritance
                                                                                                                                                          +(#95 and #99 by @clue)

                                                                                                                                                        • -

                                                                                                                                                          Feature / BC break: Only emit error event for fatal errors
                                                                                                                                                          -(#92 by @clue)

                                                                                                                                                          +

                                                                                                                                                          Feature / BC break: Only emit error event for fatal errors
                                                                                                                                                          +(#92 by @clue)

                                                                                                                                                          -

                                                                                                                                                          The error event was previously also allowed to be emitted for non-fatal
                                                                                                                                                          +

                                                                                                                                                          The error event was previously also allowed to be emitted for non-fatal
                                                                                                                                                          errors, but our implementations actually only ever emitted this as a fatal
                                                                                                                                                          error and then closed the stream.

                                                                                                                                                        • -

                                                                                                                                                          Feature: Explicitly allow custom events and exclude any semantics
                                                                                                                                                          -(#97 by @clue)

                                                                                                                                                          +

                                                                                                                                                          Feature: Explicitly allow custom events and exclude any semantics
                                                                                                                                                          +(#97 by @clue)

                                                                                                                                                        • -

                                                                                                                                                          Support legacy PHP 5.3 through PHP 7.1 and HHVM and improve usage documentation
                                                                                                                                                          -(#100 and #102 by @clue)

                                                                                                                                                          +

                                                                                                                                                          Support legacy PHP 5.3 through PHP 7.1 and HHVM and improve usage documentation
                                                                                                                                                          +(#100 and #102 by @clue)

                                                                                                                                                        • -

                                                                                                                                                          Actually require all dependencies so this is self-contained and improve
                                                                                                                                                          +

                                                                                                                                                          Actually require all dependencies so this is self-contained and improve
                                                                                                                                                          forward compatibility with EventLoop v1.0 and v0.5
                                                                                                                                                          -(#94 and #98 by @clue)

                                                                                                                                                          +(#94 and #98 by @clue)

                                                                                                                                                        @@ -7061,9 +2803,9 @@

                                                                                                                                                        -
                                                                                                                                                          +
                                                                                                                                                          • Feature: Forward compatibility with upcoming Socket v1.0 and v0.8
                                                                                                                                                            -(#61 by @clue)
                                                                                                                                                          • +(#61 by @clue)

                                                                                                                                                          @@ -7081,21 +2823,21 @@

                                                                                                                                                          -

                                                                                                                                                          This is a bug fix and improvement release:

                                                                                                                                                          -
                                                                                                                                                            -
                                                                                                                                                          • Bug fix: Bugfix in the usage sample code #57 (@dandelionred)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: Remove branch-alias definition #53 (@WyriHaximus)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: StreamSelectLoop: Use fresh time so Timers added during stream events are accurate #51 (@andrewminerd)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: Avoid deprecation warnings in test suite due to deprecation of getMock() in PHPUnit #68 (@martinschroeder)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: Add PHPUnit 4.8 to require-dev #69 (@shaunbramley)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: Increase test timeouts for HHVM and unify timeout handling #70 (@clue)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: Travis improvements (backported from #74) #75 (@clue)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: Test suite now uses socket pairs instead of memory streams #66 (@martinschroeder)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: StreamSelectLoop: Test suite uses signal constant names in data provider #67 (@martinschroeder)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: ExtEventLoop: No longer suppress all errors #65 (@mamciek)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: Readme cleanup #89 (@jsor)
                                                                                                                                                          • -
                                                                                                                                                          • Improvement: Restructure and improve README #90 (@jsor)
                                                                                                                                                          • -
                                                                                                                                                          • Bug fix: StreamSelectLoop: Fix erroneous zero-time sleep (backport to 0.4) #94 (@jsor)
                                                                                                                                                          • +

                                                                                                                                                            This is a bug fix and improvement release:

                                                                                                                                                            +
                                                                                                                                                              +
                                                                                                                                                            • Bug fix: Bugfix in the usage sample code #57 (@dandelionred)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: Remove branch-alias definition #53 (@WyriHaximus)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: StreamSelectLoop: Use fresh time so Timers added during stream events are accurate #51 (@andrewminerd)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: Avoid deprecation warnings in test suite due to deprecation of getMock() in PHPUnit #68 (@martinschroeder)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: Add PHPUnit 4.8 to require-dev #69 (@shaunbramley)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: Increase test timeouts for HHVM and unify timeout handling #70 (@clue)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: Travis improvements (backported from #74) #75 (@clue)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: Test suite now uses socket pairs instead of memory streams #66 (@martinschroeder)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: StreamSelectLoop: Test suite uses signal constant names in data provider #67 (@martinschroeder)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: ExtEventLoop: No longer suppress all errors #65 (@mamciek)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: Readme cleanup #89 (@jsor)
                                                                                                                                                            • +
                                                                                                                                                            • Improvement: Restructure and improve README #90 (@jsor)
                                                                                                                                                            • +
                                                                                                                                                            • Bug fix: StreamSelectLoop: Fix erroneous zero-time sleep (backport to 0.4) #94 (@jsor)

                                                                                                                                                            @@ -7113,9 +2855,9 @@

                                                                                                                                                            -
                                                                                                                                                              +
                                                                                                                                                              • Fix: Work around latest PHP 7.0.18 and 7.1.4 no longer accepting full URIs
                                                                                                                                                                -(#94 by @clue)
                                                                                                                                                              • +(#94 by @clue)

                                                                                                                                                              @@ -7133,11 +2875,11 @@

                                                                                                                                                              -
                                                                                                                                                                +
                                                                                                                                                                @@ -7155,9 +2897,9 @@

                                                                                                                                                                -
                                                                                                                                                                  +
                                                                                                                                                                  • Fix: Ignore HHVM errors when closing connection that is already closing
                                                                                                                                                                    -(#91 by @clue)
                                                                                                                                                                  • +(#91 by @clue)

                                                                                                                                                                  @@ -7175,34 +2917,34 @@

                                                                                                                                                                  -
                                                                                                                                                                    +
                                                                                                                                                                    • -

                                                                                                                                                                      Feature: Merge SocketClient component into this component
                                                                                                                                                                      -(#87 by @clue)

                                                                                                                                                                      -

                                                                                                                                                                      This means that this package now provides async, streaming plaintext TCP/IP
                                                                                                                                                                      +

                                                                                                                                                                      Feature: Merge SocketClient component into this component
                                                                                                                                                                      +(#87 by @clue)

                                                                                                                                                                      +

                                                                                                                                                                      This means that this package now provides async, streaming plaintext TCP/IP
                                                                                                                                                                      and secure TLS socket server and client connections for ReactPHP.

                                                                                                                                                                      -
                                                                                                                                                                      $connector = new React\Socket\Connector($loop);
                                                                                                                                                                      -$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                      -    $connection->write('');
                                                                                                                                                                      -});
                                                                                                                                                                      -

                                                                                                                                                                      Accordingly, the ConnectionInterface is now used to represent both incoming
                                                                                                                                                                      +

                                                                                                                                                                      $connector = new React\Socket\Connector($loop);
                                                                                                                                                                      +$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                      +    $connection->write('');
                                                                                                                                                                      +});
                                                                                                                                                                      +

                                                                                                                                                                      Accordingly, the ConnectionInterface is now used to represent both incoming
                                                                                                                                                                      server side connections as well as outgoing client side connections.

                                                                                                                                                                      -

                                                                                                                                                                      If you've previously used the SocketClient component to establish outgoing
                                                                                                                                                                      +

                                                                                                                                                                      If you've previously used the SocketClient component to establish outgoing
                                                                                                                                                                      client connections, upgrading should take no longer than a few minutes.
                                                                                                                                                                      -All classes have been merged as-is from the latest v0.7.0 release with no
                                                                                                                                                                      +All classes have been merged as-is from the latest v0.7.0 release with no
                                                                                                                                                                      other changes, so you can simply update your code to use the updated namespace
                                                                                                                                                                      like this:

                                                                                                                                                                      -
                                                                                                                                                                      // old from SocketClient component and namespace
                                                                                                                                                                      -$connector = new React\SocketClient\Connector($loop);
                                                                                                                                                                      -$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                      -    $connection->write('');
                                                                                                                                                                      -});
                                                                                                                                                                      -
                                                                                                                                                                      -// new
                                                                                                                                                                      -$connector = new React\Socket\Connector($loop);
                                                                                                                                                                      -$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                      -    $connection->write('');
                                                                                                                                                                      -});
                                                                                                                                                                      +
                                                                                                                                                                      // old from SocketClient component and namespace
                                                                                                                                                                      +$connector = new React\SocketClient\Connector($loop);
                                                                                                                                                                      +$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                      +    $connection->write('');
                                                                                                                                                                      +});
                                                                                                                                                                      +
                                                                                                                                                                      +// new
                                                                                                                                                                      +$connector = new React\Socket\Connector($loop);
                                                                                                                                                                      +$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                      +    $connection->write('');
                                                                                                                                                                      +});
                                                                                                                                                                    @@ -7221,62 +2963,28 @@

                                                                                                                                                                    -
                                                                                                                                                                      +
                                                                                                                                                                      • -

                                                                                                                                                                        Feature: Add LimitingServer to limit and keep track of open connections
                                                                                                                                                                        -(#86 by @clue)

                                                                                                                                                                        -
                                                                                                                                                                        $server = new Server(0, $loop);
                                                                                                                                                                        -$server = new LimitingServer($server, 100);
                                                                                                                                                                        -
                                                                                                                                                                        -$server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                        -    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                        -    …
                                                                                                                                                                        -});
                                                                                                                                                                        +

                                                                                                                                                                        Feature: Add LimitingServer to limit and keep track of open connections
                                                                                                                                                                        +(#86 by @clue)

                                                                                                                                                                        +
                                                                                                                                                                        $server = new Server(0, $loop);
                                                                                                                                                                        +$server = new LimitingServer($server, 100);
                                                                                                                                                                        +
                                                                                                                                                                        +$server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                        +    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                        +
                                                                                                                                                                        +});
                                                                                                                                                                      • -

                                                                                                                                                                        Feature / BC break: Add pause() and resume() methods to limit active
                                                                                                                                                                        +

                                                                                                                                                                        Feature / BC break: Add pause() and resume() methods to limit active
                                                                                                                                                                        connections
                                                                                                                                                                        -(#84 by @clue)

                                                                                                                                                                        -
                                                                                                                                                                        $server = new Server(0, $loop);
                                                                                                                                                                        -$server->pause();
                                                                                                                                                                        -
                                                                                                                                                                        -$loop->addTimer(1.0, function() use ($server) {
                                                                                                                                                                        -    $server->resume();
                                                                                                                                                                        -});
                                                                                                                                                                        -
                                                                                                                                                                      • -
                                                                                                                                                                      - -
                                                                                                                                                                      - -

                                                                                                                                                                      - - - SocketClient 0.7.0 - - - (2017-04-02) - - Release on GitHub - - -

                                                                                                                                                                      - -
                                                                                                                                                                        -
                                                                                                                                                                      • -

                                                                                                                                                                        Feature / BC break: Add main Connector facade
                                                                                                                                                                        -(#93 by @clue)

                                                                                                                                                                        -

                                                                                                                                                                        The new Connector class acts as a facade for all underlying connectors,
                                                                                                                                                                        -which are now marked as "advanced usage", but continue to work unchanged.
                                                                                                                                                                        -This now makes it trivially easy to create plaintext TCP/IP, secure TLS and
                                                                                                                                                                        -Unix domain socket (UDS) connection streams simply like this:

                                                                                                                                                                        -
                                                                                                                                                                        $connector = new Connector($loop);
                                                                                                                                                                        -
                                                                                                                                                                        -$connector->connect('tls://google.com:443')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                        -    $conn->write("GET / HTTP/1.0\r\n\r\n");
                                                                                                                                                                        -});
                                                                                                                                                                        -

                                                                                                                                                                        Optionally, it accepts options to configure all underlying connectors, such
                                                                                                                                                                        -as using a custom DNS setup, timeout values and disabling certain protocols
                                                                                                                                                                        -and much more. See the README for more details.

                                                                                                                                                                        +(#84 by @clue)

                                                                                                                                                                        +
                                                                                                                                                                        $server = new Server(0, $loop);
                                                                                                                                                                        +$server->pause();
                                                                                                                                                                        +
                                                                                                                                                                        +$loop->addTimer(1.0, function() use ($server) {
                                                                                                                                                                        +    $server->resume();
                                                                                                                                                                        +});
                                                                                                                                                                      @@ -7295,9 +3003,9 @@

                                                                                                                                                                      -
                                                                                                                                                                        +
                                                                                                                                                                        • Feature: Forward compatibility with upcoming Socket v0.6 and v0.7 component
                                                                                                                                                                          -(#57 by @clue)
                                                                                                                                                                        • +(#57 by @clue)

                                                                                                                                                                        @@ -7315,54 +3023,54 @@

                                                                                                                                                                        -
                                                                                                                                                                          +
                                                                                                                                                                          • -

                                                                                                                                                                            Feature / Fix / BC break: Add DuplexResourceStream and deprecate Stream
                                                                                                                                                                            -(#85 by @clue)

                                                                                                                                                                            -
                                                                                                                                                                            // old (does still work for BC reasons)
                                                                                                                                                                            -$stream = new Stream($connection, $loop);
                                                                                                                                                                            -
                                                                                                                                                                            -// new
                                                                                                                                                                            -$stream = new DuplexResourceStream($connection, $loop);
                                                                                                                                                                            -

                                                                                                                                                                            Note that the DuplexResourceStream now rejects read-only or write-only
                                                                                                                                                                            +

                                                                                                                                                                            Feature / Fix / BC break: Add DuplexResourceStream and deprecate Stream
                                                                                                                                                                            +(#85 by @clue)

                                                                                                                                                                            +
                                                                                                                                                                            // old (does still work for BC reasons)
                                                                                                                                                                            +$stream = new Stream($connection, $loop);
                                                                                                                                                                            +
                                                                                                                                                                            +// new
                                                                                                                                                                            +$stream = new DuplexResourceStream($connection, $loop);
                                                                                                                                                                            +

                                                                                                                                                                            Note that the DuplexResourceStream now rejects read-only or write-only
                                                                                                                                                                            streams, so this may affect BC. If you want a read-only or write-only
                                                                                                                                                                            -resource, use ReadableResourceStream or WritableResourceStream instead of
                                                                                                                                                                            -DuplexResourceStream.

                                                                                                                                                                            +resource, use ReadableResourceStream or WritableResourceStream instead of
                                                                                                                                                                            +DuplexResourceStream.

                                                                                                                                                                            -

                                                                                                                                                                            BC note: This class was previously called Stream. The Stream class still
                                                                                                                                                                            +

                                                                                                                                                                            BC note: This class was previously called Stream. The Stream class still
                                                                                                                                                                            exists for BC reasons and will be removed in future versions of this package.

                                                                                                                                                                          • -

                                                                                                                                                                            Feature / BC break: Add WritableResourceStream (previously called Buffer)
                                                                                                                                                                            -(#84 by @clue)

                                                                                                                                                                            -
                                                                                                                                                                            // old
                                                                                                                                                                            -$stream = new Buffer(STDOUT, $loop);
                                                                                                                                                                            -
                                                                                                                                                                            -// new
                                                                                                                                                                            -$stream = new WritableResourceStream(STDOUT, $loop);
                                                                                                                                                                            +

                                                                                                                                                                            Feature / BC break: Add WritableResourceStream (previously called Buffer)
                                                                                                                                                                            +(#84 by @clue)

                                                                                                                                                                            +
                                                                                                                                                                            // old
                                                                                                                                                                            +$stream = new Buffer(STDOUT, $loop);
                                                                                                                                                                            +
                                                                                                                                                                            +// new
                                                                                                                                                                            +$stream = new WritableResourceStream(STDOUT, $loop);
                                                                                                                                                                          • -

                                                                                                                                                                            Feature: Add ReadableResourceStream
                                                                                                                                                                            -(#83 by @clue)

                                                                                                                                                                            -
                                                                                                                                                                            $stream = new ReadableResourceStream(STDIN, $loop);
                                                                                                                                                                            +

                                                                                                                                                                            Feature: Add ReadableResourceStream
                                                                                                                                                                            +(#83 by @clue)

                                                                                                                                                                            +
                                                                                                                                                                            $stream = new ReadableResourceStream(STDIN, $loop);
                                                                                                                                                                          • -

                                                                                                                                                                            Fix / BC Break: Enforce using non-blocking I/O
                                                                                                                                                                            -(#46 by @clue)

                                                                                                                                                                            +

                                                                                                                                                                            Fix / BC Break: Enforce using non-blocking I/O
                                                                                                                                                                            +(#46 by @clue)

                                                                                                                                                                            -

                                                                                                                                                                            BC note: This is known to affect process pipes on Windows which do not
                                                                                                                                                                            +

                                                                                                                                                                            BC note: This is known to affect process pipes on Windows which do not
                                                                                                                                                                            support non-blocking I/O and could thus block the whole EventLoop previously.

                                                                                                                                                                          • -

                                                                                                                                                                            Feature / Fix / BC break: Consistent semantics for
                                                                                                                                                                            -DuplexStreamInterface::end() to ensure it SHOULD also end readable side
                                                                                                                                                                            -(#86 by @clue)

                                                                                                                                                                            +

                                                                                                                                                                            Feature / Fix / BC break: Consistent semantics for
                                                                                                                                                                            +DuplexStreamInterface::end() to ensure it SHOULD also end readable side
                                                                                                                                                                            +(#86 by @clue)

                                                                                                                                                                          • -

                                                                                                                                                                            Fix: Do not use unbuffered reads on pipe streams for legacy PHP < 5.4
                                                                                                                                                                            -(#80 by @clue)

                                                                                                                                                                            +

                                                                                                                                                                            Fix: Do not use unbuffered reads on pipe streams for legacy PHP < 5.4
                                                                                                                                                                            +(#80 by @clue)

                                                                                                                                                                          @@ -7381,8 +3089,8 @@

                                                                                                                                                                          -
                                                                                                                                                                            -
                                                                                                                                                                          • Fix circular references when resolving with a promise which follows itself (#94).
                                                                                                                                                                          • +
                                                                                                                                                                              +
                                                                                                                                                                            • Fix circular references when resolving with a promise which follows itself (#94).

                                                                                                                                                                            @@ -7390,7 +3098,7 @@

                                                                                                                                                                            - HttpClient 0.4.17 + HTTPClient 0.4.17 (2017-03-20) @@ -7400,30 +3108,9 @@

                                                                                                                                                                            -
                                                                                                                                                                              -
                                                                                                                                                                            • Improvement: Add PHPUnit to require-dev #75 @jsor
                                                                                                                                                                            • -
                                                                                                                                                                            • Fix: Fix chunk header to be case-insensitive and allow leading zeros for end chunk #77 @mdrost
                                                                                                                                                                            • -
                                                                                                                                                                            - -
                                                                                                                                                                            - -

                                                                                                                                                                            - - - SocketClient 0.6.2 - - - (2017-03-17) - - Release on GitHub - - -

                                                                                                                                                                            -
                                                                                                                                                                              -
                                                                                                                                                                            • Feature / Fix: Support SNI on legacy PHP < 5.6 and add documentation for
                                                                                                                                                                              -supported PHP and HHVM versions.
                                                                                                                                                                              -(#90 and #91 by @clue)
                                                                                                                                                                            • +
                                                                                                                                                                            • Improvement: Add PHPUnit to require-dev #75 @jsor
                                                                                                                                                                            • +
                                                                                                                                                                            • Fix: Fix chunk header to be case-insensitive and allow leading zeros for end chunk #77 @mdrost

                                                                                                                                                                            @@ -7441,14 +3128,14 @@

                                                                                                                                                                            -
                                                                                                                                                                              +
                                                                                                                                                                              • -

                                                                                                                                                                                Ease getting started by improving documentation and adding examples
                                                                                                                                                                                -(#33 and #34 by @clue)

                                                                                                                                                                                +

                                                                                                                                                                                Ease getting started by improving documentation and adding examples
                                                                                                                                                                                +(#33 and #34 by @clue)

                                                                                                                                                                              • -

                                                                                                                                                                                First class support for PHP 5.3 through PHP 7.1 and HHVM
                                                                                                                                                                                -(#29 by @clue and #32 by @WyriHaximus)

                                                                                                                                                                                +

                                                                                                                                                                                First class support for PHP 5.3 through PHP 7.1 and HHVM
                                                                                                                                                                                +(#29 by @clue and #32 by @WyriHaximus)

                                                                                                                                                                              @@ -7467,12 +3154,12 @@

                                                                                                                                                                              -
                                                                                                                                                                                +
                                                                                                                                                                                • Fix: Fix DNS timeout issues for Windows users and add forward compatibility
                                                                                                                                                                                  with Stream v0.5 and upcoming v0.6
                                                                                                                                                                                  -(#53 by @clue)
                                                                                                                                                                                • -
                                                                                                                                                                                • Improve test suite by adding PHPUnit to require-dev
                                                                                                                                                                                  -(#54 by @clue)
                                                                                                                                                                                • +(#53 by @clue) +
                                                                                                                                                                                • Improve test suite by adding PHPUnit to require-dev
                                                                                                                                                                                  +(#54 by @clue)

                                                                                                                                                                                @@ -7490,40 +3177,14 @@

                                                                                                                                                                                -
                                                                                                                                                                                  -
                                                                                                                                                                                • -

                                                                                                                                                                                  Feature: Forward compatibility with Stream v0.5
                                                                                                                                                                                  -(#26 by @clue)

                                                                                                                                                                                  -
                                                                                                                                                                                • -
                                                                                                                                                                                • -

                                                                                                                                                                                  Improve test suite by removing AppVeyor and adding PHPUnit to require-dev
                                                                                                                                                                                  -(#27 and #28 by @clue)

                                                                                                                                                                                  -
                                                                                                                                                                                • -
                                                                                                                                                                                - -
                                                                                                                                                                                - -

                                                                                                                                                                                - - - SocketClient 0.6.1 - - - (2017-03-10) - - Release on GitHub - - -

                                                                                                                                                                                -
                                                                                                                                                                                • -

                                                                                                                                                                                  Feature: Forward compatibility with Stream v0.5 and upcoming v0.6
                                                                                                                                                                                  -(#89 by @clue)

                                                                                                                                                                                  +

                                                                                                                                                                                  Feature: Forward compatibility with Stream v0.5
                                                                                                                                                                                  +(#26 by @clue)

                                                                                                                                                                                • -

                                                                                                                                                                                  Fix: Fix examples to use updated API
                                                                                                                                                                                  -(#88 by @clue)

                                                                                                                                                                                  +

                                                                                                                                                                                  Improve test suite by removing AppVeyor and adding PHPUnit to require-dev
                                                                                                                                                                                  +(#27 and #28 by @clue)

                                                                                                                                                                                @@ -7542,55 +3203,55 @@

                                                                                                                                                                                -
                                                                                                                                                                                  +
                                                                                                                                                                                  • -

                                                                                                                                                                                    Feature / BC break: The Request and Response objects now follow strict
                                                                                                                                                                                    +

                                                                                                                                                                                    Feature / BC break: The Request and Response objects now follow strict
                                                                                                                                                                                    stream semantics and their respective methods and events.
                                                                                                                                                                                    -(#116, #129, #133, #135, #136, #137, #138, #140, #141 by @legionth
                                                                                                                                                                                    -and #122, #123, #130, #131, #132, #142 by @clue)

                                                                                                                                                                                    -

                                                                                                                                                                                    This implies that the Server now supports proper detection of the request
                                                                                                                                                                                    +(#116, #129, #133, #135, #136, #137, #138, #140, #141 by @legionth
                                                                                                                                                                                    +and #122, #123, #130, #131, #132, #142 by @clue)

                                                                                                                                                                                    +

                                                                                                                                                                                    This implies that the Server now supports proper detection of the request
                                                                                                                                                                                    message body stream, such as supporting decoding chunked transfer encoding,
                                                                                                                                                                                    -delimiting requests with an explicit Content-Length header
                                                                                                                                                                                    +delimiting requests with an explicit Content-Length header
                                                                                                                                                                                    and those with an empty request message body.

                                                                                                                                                                                    -

                                                                                                                                                                                    These streaming semantics are compatible with previous Stream v0.5, future
                                                                                                                                                                                    +

                                                                                                                                                                                    These streaming semantics are compatible with previous Stream v0.5, future
                                                                                                                                                                                    compatible with v0.5 and upcoming v0.6 versions and can be used like this:

                                                                                                                                                                                    -
                                                                                                                                                                                    $http->on('request', function (Request $request, Response $response) {
                                                                                                                                                                                    -    $contentLength = 0;
                                                                                                                                                                                    -    $request->on('data', function ($data) use (&$contentLength) {
                                                                                                                                                                                    -        $contentLength += strlen($data);
                                                                                                                                                                                    -    });
                                                                                                                                                                                    -
                                                                                                                                                                                    -    $request->on('end', function () use ($response, &$contentLength){
                                                                                                                                                                                    -        $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                    -        $response->end("The length of the submitted request body is: " . $contentLength);
                                                                                                                                                                                    -    });
                                                                                                                                                                                    -
                                                                                                                                                                                    -    // an error occured
                                                                                                                                                                                    -    // e.g. on invalid chunked encoded data or an unexpected 'end' event 
                                                                                                                                                                                    -    $request->on('error', function (\Exception $exception) use ($response, &$contentLength) {
                                                                                                                                                                                    -        $response->writeHead(400, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                    -        $response->end("An error occured while reading at length: " . $contentLength);
                                                                                                                                                                                    -    });
                                                                                                                                                                                    -});
                                                                                                                                                                                    -

                                                                                                                                                                                    Similarly, the Request and Response now strictly follow the
                                                                                                                                                                                    -close() method and close event semantics.
                                                                                                                                                                                    -Closing the Request does not interrupt the underlying TCP/IP in
                                                                                                                                                                                    +

                                                                                                                                                                                    $http->on('request', function (Request $request, Response $response) {
                                                                                                                                                                                    +    $contentLength = 0;
                                                                                                                                                                                    +    $request->on('data', function ($data) use (&$contentLength) {
                                                                                                                                                                                    +        $contentLength += strlen($data);
                                                                                                                                                                                    +    });
                                                                                                                                                                                    +
                                                                                                                                                                                    +    $request->on('end', function () use ($response, &$contentLength){
                                                                                                                                                                                    +        $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                    +        $response->end("The length of the submitted request body is: " . $contentLength);
                                                                                                                                                                                    +    });
                                                                                                                                                                                    +
                                                                                                                                                                                    +    // an error occured
                                                                                                                                                                                    +    // e.g. on invalid chunked encoded data or an unexpected 'end' event 
                                                                                                                                                                                    +    $request->on('error', function (\Exception $exception) use ($response, &$contentLength) {
                                                                                                                                                                                    +        $response->writeHead(400, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                    +        $response->end("An error occured while reading at length: " . $contentLength);
                                                                                                                                                                                    +    });
                                                                                                                                                                                    +});
                                                                                                                                                                                    +

                                                                                                                                                                                    Similarly, the Request and Response now strictly follow the
                                                                                                                                                                                    +close() method and close event semantics.
                                                                                                                                                                                    +Closing the Request does not interrupt the underlying TCP/IP in
                                                                                                                                                                                    order to allow still sending back a valid response message.
                                                                                                                                                                                    -Closing the Response does terminate the underlying TCP/IP
                                                                                                                                                                                    +Closing the Response does terminate the underlying TCP/IP
                                                                                                                                                                                    connection in order to clean up resources.

                                                                                                                                                                                    -

                                                                                                                                                                                    You should make sure to always attach a request event listener
                                                                                                                                                                                    -like above. The Server will not respond to an incoming HTTP
                                                                                                                                                                                    +

                                                                                                                                                                                    You should make sure to always attach a request event listener
                                                                                                                                                                                    +like above. The Server will not respond to an incoming HTTP
                                                                                                                                                                                    request otherwise and keep the TCP/IP connection pending until the
                                                                                                                                                                                    other side chooses to close the connection.

                                                                                                                                                                                  • -

                                                                                                                                                                                    Feature: Support HTTP/1.1 and HTTP/1.0 for Request and Response.
                                                                                                                                                                                    -(#124, #125, #126, #127, #128 by @clue and #139 by @legionth)

                                                                                                                                                                                    -

                                                                                                                                                                                    The outgoing Response will automatically use the same HTTP version as the
                                                                                                                                                                                    -incoming Request message and will only apply HTTP/1.1 semantics if
                                                                                                                                                                                    -applicable. This includes that the Response will automatically attach a
                                                                                                                                                                                    -Date and Connection: close header if applicable.

                                                                                                                                                                                    -

                                                                                                                                                                                    This implies that the Server now automatically responds with HTTP error
                                                                                                                                                                                    +

                                                                                                                                                                                    Feature: Support HTTP/1.1 and HTTP/1.0 for Request and Response.
                                                                                                                                                                                    +(#124, #125, #126, #127, #128 by @clue and #139 by @legionth)

                                                                                                                                                                                    +

                                                                                                                                                                                    The outgoing Response will automatically use the same HTTP version as the
                                                                                                                                                                                    +incoming Request message and will only apply HTTP/1.1 semantics if
                                                                                                                                                                                    +applicable. This includes that the Response will automatically attach a
                                                                                                                                                                                    +Date and Connection: close header if applicable.

                                                                                                                                                                                    +

                                                                                                                                                                                    This implies that the Server now automatically responds with HTTP error
                                                                                                                                                                                    messages for invalid requests (status 400) and those exceeding internal
                                                                                                                                                                                    request header limits (status 431).

                                                                                                                                                                                  • @@ -7611,9 +3272,9 @@

                                                                                                                                                                                    -
                                                                                                                                                                                      +
                                                                                                                                                                                      • Feature: Forward compatibility with Stream v0.5 and upcoming v0.6
                                                                                                                                                                                        -(#79 by @clue)
                                                                                                                                                                                      • +(#79 by @clue)

                                                                                                                                                                                      @@ -7631,49 +3292,49 @@

                                                                                                                                                                                      -
                                                                                                                                                                                        +
                                                                                                                                                                                        • -

                                                                                                                                                                                          Feature / BC break: Consistent end event semantics (EOF)
                                                                                                                                                                                          -(#70 by @clue)

                                                                                                                                                                                          -

                                                                                                                                                                                          The end event will now only be emitted for a successful end, not if the
                                                                                                                                                                                          -stream closes due to an unrecoverable error event or if you call close()
                                                                                                                                                                                          +

                                                                                                                                                                                          Feature / BC break: Consistent end event semantics (EOF)
                                                                                                                                                                                          +(#70 by @clue)

                                                                                                                                                                                          +

                                                                                                                                                                                          The end event will now only be emitted for a successful end, not if the
                                                                                                                                                                                          +stream closes due to an unrecoverable error event or if you call close()
                                                                                                                                                                                          explicitly.
                                                                                                                                                                                          -If you want to detect when the stream closes (terminates), use the close
                                                                                                                                                                                          +If you want to detect when the stream closes (terminates), use the close
                                                                                                                                                                                          event instead.

                                                                                                                                                                                        • -

                                                                                                                                                                                          BC break: Remove custom (undocumented) full-drain event from Buffer
                                                                                                                                                                                          -(#63 and #68 by @clue)

                                                                                                                                                                                          +

                                                                                                                                                                                          BC break: Remove custom (undocumented) full-drain event from Buffer
                                                                                                                                                                                          +(#63 and #68 by @clue)

                                                                                                                                                                                          -

                                                                                                                                                                                          The full-drain event was undocumented and mostly used internally.
                                                                                                                                                                                          +

                                                                                                                                                                                          The full-drain event was undocumented and mostly used internally.
                                                                                                                                                                                          Relying on this event has attracted some low-quality code in the past, so
                                                                                                                                                                                          we've removed this from the public API in order to work out a better
                                                                                                                                                                                          solution instead.
                                                                                                                                                                                          If you want to detect when the buffer finishes flushing data to the stream,
                                                                                                                                                                                          -you may want to look into its end() method or the close event instead.

                                                                                                                                                                                          +you may want to look into its end() method or the close event instead.

                                                                                                                                                                                        • -

                                                                                                                                                                                          Feature / BC break: Consistent event semantics and documentation,
                                                                                                                                                                                          +

                                                                                                                                                                                          Feature / BC break: Consistent event semantics and documentation,
                                                                                                                                                                                          explicitly state when events will be emitted and which arguments they
                                                                                                                                                                                          receive.
                                                                                                                                                                                          -(#73 and #69 by @clue)

                                                                                                                                                                                          -

                                                                                                                                                                                          The documentation now explicitly defines each event and its arguments.
                                                                                                                                                                                          +(#73 and #69 by @clue)

                                                                                                                                                                                          +

                                                                                                                                                                                          The documentation now explicitly defines each event and its arguments.
                                                                                                                                                                                          Custom events and event arguments are still supported.
                                                                                                                                                                                          Most notably, all defined events only receive inherently required event
                                                                                                                                                                                          arguments and no longer transmit the instance they are emitted on for
                                                                                                                                                                                          consistency and performance reasons.

                                                                                                                                                                                          -
                                                                                                                                                                                          // old (inconsistent and not supported by all implementations)
                                                                                                                                                                                          -$stream->on('data', function ($data, $stream) {
                                                                                                                                                                                          -    // process $data
                                                                                                                                                                                          -});
                                                                                                                                                                                          -
                                                                                                                                                                                          -// new (consistent throughout the whole ecosystem)
                                                                                                                                                                                          -$stream->on('data', function ($data) use ($stream) {
                                                                                                                                                                                          -    // process $data
                                                                                                                                                                                          -});
                                                                                                                                                                                          +
                                                                                                                                                                                          // old (inconsistent and not supported by all implementations)
                                                                                                                                                                                          +$stream->on('data', function ($data, $stream) {
                                                                                                                                                                                          +    // process $data
                                                                                                                                                                                          +});
                                                                                                                                                                                          +
                                                                                                                                                                                          +// new (consistent throughout the whole ecosystem)
                                                                                                                                                                                          +$stream->on('data', function ($data) use ($stream) {
                                                                                                                                                                                          +    // process $data
                                                                                                                                                                                          +});
                                                                                                                                                                                          -

                                                                                                                                                                                          This mostly adds documentation (and thus some stricter, consistent
                                                                                                                                                                                          +

                                                                                                                                                                                          This mostly adds documentation (and thus some stricter, consistent
                                                                                                                                                                                          definitions) for the existing behavior, it does NOT define any major
                                                                                                                                                                                          changes otherwise.
                                                                                                                                                                                          Most existing code should be compatible with these changes, unless
                                                                                                                                                                                          @@ -7681,10 +3342,10 @@

                                                                                                                                                                                        • -

                                                                                                                                                                                          Feature / BC break: Consistent method semantics and documentation
                                                                                                                                                                                          -(#72 by @clue)

                                                                                                                                                                                          +

                                                                                                                                                                                          Feature / BC break: Consistent method semantics and documentation
                                                                                                                                                                                          +(#72 by @clue)

                                                                                                                                                                                          -

                                                                                                                                                                                          This mostly adds documentation (and thus some stricter, consistent
                                                                                                                                                                                          +

                                                                                                                                                                                          This mostly adds documentation (and thus some stricter, consistent
                                                                                                                                                                                          definitions) for the existing behavior, it does NOT define any major
                                                                                                                                                                                          changes otherwise.
                                                                                                                                                                                          Most existing code should be compatible with these changes, unless
                                                                                                                                                                                          @@ -7692,15 +3353,15 @@

                                                                                                                                                                                        • -

                                                                                                                                                                                          Feature: Consistent pipe() semantics for closed and closing streams
                                                                                                                                                                                          -(#71 from @clue)

                                                                                                                                                                                          -

                                                                                                                                                                                          The source stream will now always be paused via pause() when the
                                                                                                                                                                                          +

                                                                                                                                                                                          Feature: Consistent pipe() semantics for closed and closing streams
                                                                                                                                                                                          +(#71 from @clue)

                                                                                                                                                                                          +

                                                                                                                                                                                          The source stream will now always be paused via pause() when the
                                                                                                                                                                                          destination stream closes. Also, properly stop piping if the source
                                                                                                                                                                                          stream closes and remove all event forwarding.

                                                                                                                                                                                        • -

                                                                                                                                                                                          Improve test suite by adding PHPUnit to require-dev and improving coverage.
                                                                                                                                                                                          -(#74 and #75 by @clue, #66 by @nawarian)

                                                                                                                                                                                          +

                                                                                                                                                                                          Improve test suite by adding PHPUnit to require-dev and improving coverage.
                                                                                                                                                                                          +(#74 and #75 by @clue, #66 by @nawarian)

                                                                                                                                                                                        @@ -7719,12 +3380,12 @@

                                                                                                                                                                                        -
                                                                                                                                                                                          +
                                                                                                                                                                                          • Fix: Ensure we ignore the case of the answer
                                                                                                                                                                                            -(#51 by @WyriHaximus)
                                                                                                                                                                                          • -
                                                                                                                                                                                          • Feature: Add TimeoutExecutor and simplify internal APIs to allow internal
                                                                                                                                                                                            +(#51 by @WyriHaximus)
                                                                                                                                                                                          • +
                                                                                                                                                                                          • Feature: Add TimeoutExecutor and simplify internal APIs to allow internal
                                                                                                                                                                                            code re-use for upcoming versions.
                                                                                                                                                                                            -(#48 and #49 by @clue)
                                                                                                                                                                                          • +(#48 and #49 by @clue)

                                                                                                                                                                                          @@ -7732,7 +3393,7 @@

                                                                                                                                                                                          - HttpClient 0.4.16 + HTTPClient 0.4.16 (2017-03-01) @@ -7742,77 +3403,8 @@

                                                                                                                                                                                          - - -
                                                                                                                                                                                          - -

                                                                                                                                                                                          - - - SocketClient 0.6.0 - - - (2017-02-17) - - Release on GitHub - - -

                                                                                                                                                                                          -
                                                                                                                                                                                            -
                                                                                                                                                                                          • -

                                                                                                                                                                                            Feature / BC break: Use connect($uri) instead of create($host, $port)
                                                                                                                                                                                            -and resolve with a ConnectionInterface instead of Stream
                                                                                                                                                                                            -and expose remote and local addresses through this interface
                                                                                                                                                                                            -and remove superfluous and undocumented ConnectionException.
                                                                                                                                                                                            -(#74, #82 and #84 by @clue)

                                                                                                                                                                                            -
                                                                                                                                                                                            // old
                                                                                                                                                                                            -$connector->create('google.com', 80)->then(function (Stream $conn) {
                                                                                                                                                                                            -    echo 'Connected' . PHP_EOL;
                                                                                                                                                                                            -    $conn->write("GET / HTTP/1.0\r\n\r\n");
                                                                                                                                                                                            -});
                                                                                                                                                                                            -
                                                                                                                                                                                            -// new
                                                                                                                                                                                            -$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                                            -    echo 'Connected to ' . $conn->getRemoteAddress() . PHP_EOL;
                                                                                                                                                                                            -    $conn->write("GET / HTTP/1.0\r\n\r\n");
                                                                                                                                                                                            -});
                                                                                                                                                                                            -
                                                                                                                                                                                            -

                                                                                                                                                                                            Note that both the old Stream and the new ConnectionInterface implement
                                                                                                                                                                                            -the same underlying DuplexStreamInterface, so their streaming behavior is
                                                                                                                                                                                            -actually equivalent.
                                                                                                                                                                                            -In order to upgrade, simply use the new typehints.
                                                                                                                                                                                            -Existing stream handlers should continue to work unchanged.

                                                                                                                                                                                            -
                                                                                                                                                                                            -
                                                                                                                                                                                          • -
                                                                                                                                                                                          • -

                                                                                                                                                                                            Feature / BC break: All connectors now MUST offer cancellation support.
                                                                                                                                                                                            -You can now rely on getting a rejected promise when calling cancel() on a
                                                                                                                                                                                            -pending connection attempt.
                                                                                                                                                                                            -(#79 by @clue)

                                                                                                                                                                                            -
                                                                                                                                                                                            // old: promise resolution not enforced and thus unreliable
                                                                                                                                                                                            -$promise = $connector->create($host, $port);
                                                                                                                                                                                            -$promise->cancel();
                                                                                                                                                                                            -$promise->then(/* MAY still be called */, /* SHOULD be called */);
                                                                                                                                                                                            -
                                                                                                                                                                                            -// new: rejecting after cancellation is mandatory
                                                                                                                                                                                            -$promise = $connector->connect($uri);
                                                                                                                                                                                            -$promise->cancel();
                                                                                                                                                                                            -$promise->then(/* MUST NOT be called */, /* MUST be called */);
                                                                                                                                                                                            -
                                                                                                                                                                                            -

                                                                                                                                                                                            Note that this behavior is only mandatory for pending connection attempts.
                                                                                                                                                                                            -Once the promise is settled (resolved), calling cancel() will have no effect.

                                                                                                                                                                                            -
                                                                                                                                                                                            -
                                                                                                                                                                                          • -
                                                                                                                                                                                          • -

                                                                                                                                                                                            BC break: All connector classes are now marked final
                                                                                                                                                                                            -and you can no longer extend them
                                                                                                                                                                                            -(which was never documented or recommended anyway).
                                                                                                                                                                                            -Please use composition instead of extension.
                                                                                                                                                                                            -(#85 by @clue)

                                                                                                                                                                                            -
                                                                                                                                                                                          • +
                                                                                                                                                                                          • Fix: Trim leading zeros from chunk size #73 @maciejmrozinski

                                                                                                                                                                                          @@ -7830,41 +3422,41 @@

                                                                                                                                                                                          -
                                                                                                                                                                                            +
                                                                                                                                                                                            • -

                                                                                                                                                                                              Feature / BC break: Change Request methods to be in line with PSR-7
                                                                                                                                                                                              -(#117 by @clue)

                                                                                                                                                                                              -
                                                                                                                                                                                                -
                                                                                                                                                                                              • Rename getQuery() to getQueryParams()
                                                                                                                                                                                              • -
                                                                                                                                                                                              • Rename getHttpVersion() to getProtocolVersion()
                                                                                                                                                                                              • -
                                                                                                                                                                                              • Change getHeaders() to always return an array of string values
                                                                                                                                                                                                +

                                                                                                                                                                                                Feature / BC break: Change Request methods to be in line with PSR-7
                                                                                                                                                                                                +(#117 by @clue)

                                                                                                                                                                                                +
                                                                                                                                                                                                  +
                                                                                                                                                                                                • Rename getQuery() to getQueryParams()
                                                                                                                                                                                                • +
                                                                                                                                                                                                • Rename getHttpVersion() to getProtocolVersion()
                                                                                                                                                                                                • +
                                                                                                                                                                                                • Change getHeaders() to always return an array of string values
                                                                                                                                                                                                  for each header
                                                                                                                                                                                              • -

                                                                                                                                                                                                Feature / BC break: Update Socket component to v0.5 and
                                                                                                                                                                                                +

                                                                                                                                                                                                Feature / BC break: Update Socket component to v0.5 and
                                                                                                                                                                                                add secure HTTPS server support
                                                                                                                                                                                                -(#90 and #119 by @clue)

                                                                                                                                                                                                -
                                                                                                                                                                                                // old plaintext HTTP server
                                                                                                                                                                                                -$socket = new React\Socket\Server($loop);
                                                                                                                                                                                                -$socket->listen(8080, '127.0.0.1');
                                                                                                                                                                                                -$http = new React\Http\Server($socket);
                                                                                                                                                                                                -
                                                                                                                                                                                                -// new plaintext HTTP server
                                                                                                                                                                                                -$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                -$http = new React\Http\Server($socket);
                                                                                                                                                                                                -
                                                                                                                                                                                                -// new secure HTTPS server
                                                                                                                                                                                                -$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                -$socket = new React\Socket\SecureServer($socket, $loop, array(
                                                                                                                                                                                                -    'local_cert' => __DIR__ . '/localhost.pem'
                                                                                                                                                                                                -));
                                                                                                                                                                                                -$http = new React\Http\Server($socket);
                                                                                                                                                                                                +(#90 and #119 by @clue)

                                                                                                                                                                                                +
                                                                                                                                                                                                // old plaintext HTTP server
                                                                                                                                                                                                +$socket = new React\Socket\Server($loop);
                                                                                                                                                                                                +$socket->listen(8080, '127.0.0.1');
                                                                                                                                                                                                +$http = new React\Http\Server($socket);
                                                                                                                                                                                                +
                                                                                                                                                                                                +// new plaintext HTTP server
                                                                                                                                                                                                +$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                +$http = new React\Http\Server($socket);
                                                                                                                                                                                                +
                                                                                                                                                                                                +// new secure HTTPS server
                                                                                                                                                                                                +$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                +$socket = new React\Socket\SecureServer($socket, $loop, array(
                                                                                                                                                                                                +    'local_cert' => __DIR__ . '/localhost.pem'
                                                                                                                                                                                                +));
                                                                                                                                                                                                +$http = new React\Http\Server($socket);
                                                                                                                                                                                              • -

                                                                                                                                                                                                BC break: Mark internal APIs as internal or private and
                                                                                                                                                                                                -remove unneeded ServerInterface
                                                                                                                                                                                                -(#118 by @clue, #95 by @legionth)

                                                                                                                                                                                                +

                                                                                                                                                                                                BC break: Mark internal APIs as internal or private and
                                                                                                                                                                                                +remove unneeded ServerInterface
                                                                                                                                                                                                +(#118 by @clue, #95 by @legionth)

                                                                                                                                                                                              @@ -7883,83 +3475,83 @@

                                                                                                                                                                                              -
                                                                                                                                                                                                +
                                                                                                                                                                                                • -

                                                                                                                                                                                                  Feature / BC break: Replace listen() call with URIs passed to constructor
                                                                                                                                                                                                  -and reject listening on hostnames with InvalidArgumentException
                                                                                                                                                                                                  -and replace ConnectionException with RuntimeException for consistency
                                                                                                                                                                                                  -(#61, #66 and #72 by @clue)

                                                                                                                                                                                                  -
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  -$server = new Server($loop);
                                                                                                                                                                                                  -$server->listen(8080);
                                                                                                                                                                                                  -
                                                                                                                                                                                                  -// new
                                                                                                                                                                                                  -$server = new Server(8080, $loop);
                                                                                                                                                                                                  -

                                                                                                                                                                                                  Similarly, you can now pass a full listening URI to the constructor to change
                                                                                                                                                                                                  +

                                                                                                                                                                                                  Feature / BC break: Replace listen() call with URIs passed to constructor
                                                                                                                                                                                                  +and reject listening on hostnames with InvalidArgumentException
                                                                                                                                                                                                  +and replace ConnectionException with RuntimeException for consistency
                                                                                                                                                                                                  +(#61, #66 and #72 by @clue)

                                                                                                                                                                                                  +
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  +$server = new Server($loop);
                                                                                                                                                                                                  +$server->listen(8080);
                                                                                                                                                                                                  +
                                                                                                                                                                                                  +// new
                                                                                                                                                                                                  +$server = new Server(8080, $loop);
                                                                                                                                                                                                  +

                                                                                                                                                                                                  Similarly, you can now pass a full listening URI to the constructor to change
                                                                                                                                                                                                  the listening host:

                                                                                                                                                                                                  -
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  -$server = new Server($loop);
                                                                                                                                                                                                  -$server->listen(8080, '127.0.0.1');
                                                                                                                                                                                                  -
                                                                                                                                                                                                  -// new
                                                                                                                                                                                                  -$server = new Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                  -

                                                                                                                                                                                                  Trying to start listening on (DNS) host names will now throw an
                                                                                                                                                                                                  -InvalidArgumentException, use IP addresses instead:

                                                                                                                                                                                                  -
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  -$server = new Server($loop);
                                                                                                                                                                                                  -$server->listen(8080, 'localhost');
                                                                                                                                                                                                  -
                                                                                                                                                                                                  -// new
                                                                                                                                                                                                  -$server = new Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                  -

                                                                                                                                                                                                  If trying to listen fails (such as if port is already in use or port below
                                                                                                                                                                                                  -1024 may require root access etc.), it will now throw a RuntimeException,
                                                                                                                                                                                                  -the ConnectionException class has been removed:

                                                                                                                                                                                                  -
                                                                                                                                                                                                  // old: throws React\Socket\ConnectionException
                                                                                                                                                                                                  -$server = new Server($loop);
                                                                                                                                                                                                  -$server->listen(80);
                                                                                                                                                                                                  -
                                                                                                                                                                                                  -// new: throws RuntimeException
                                                                                                                                                                                                  -$server = new Server(80, $loop);
                                                                                                                                                                                                  -
                                                                                                                                                                                                • -
                                                                                                                                                                                                • -

                                                                                                                                                                                                  Feature / BC break: Rename shutdown() to close() for consistency throughout React
                                                                                                                                                                                                  -(#62 by @clue)

                                                                                                                                                                                                  -
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  -$server->shutdown();
                                                                                                                                                                                                  -
                                                                                                                                                                                                  -// new
                                                                                                                                                                                                  -$server->close();
                                                                                                                                                                                                  -
                                                                                                                                                                                                • -
                                                                                                                                                                                                • -

                                                                                                                                                                                                  Feature / BC break: Replace getPort() with getAddress()
                                                                                                                                                                                                  -(#67 by @clue)

                                                                                                                                                                                                  -
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  -echo $server->getPort(); // 8080
                                                                                                                                                                                                  -
                                                                                                                                                                                                  -// new
                                                                                                                                                                                                  -echo $server->getAddress(); // 127.0.0.1:8080
                                                                                                                                                                                                  -
                                                                                                                                                                                                • -
                                                                                                                                                                                                • -

                                                                                                                                                                                                  Feature / BC break: getRemoteAddress() returns full address instead of only IP
                                                                                                                                                                                                  -(#65 by @clue)

                                                                                                                                                                                                  -
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  -echo $connection->getRemoteAddress(); // 192.168.0.1
                                                                                                                                                                                                  -
                                                                                                                                                                                                  -// new
                                                                                                                                                                                                  -echo $connection->getRemoteAddress(); // 192.168.0.1:51743
                                                                                                                                                                                                  -
                                                                                                                                                                                                • -
                                                                                                                                                                                                • -

                                                                                                                                                                                                  Feature / BC break: Add getLocalAddress() method
                                                                                                                                                                                                  -(#68 by @clue)

                                                                                                                                                                                                  -
                                                                                                                                                                                                  echo $connection->getLocalAddress(); // 127.0.0.1:8080
                                                                                                                                                                                                  -
                                                                                                                                                                                                • -
                                                                                                                                                                                                • -

                                                                                                                                                                                                  BC break: The Server and SecureServer class are now marked final
                                                                                                                                                                                                  -and you can no longer extend them
                                                                                                                                                                                                  +

                                                                                                                                                                                                  // old
                                                                                                                                                                                                  +$server = new Server($loop);
                                                                                                                                                                                                  +$server->listen(8080, '127.0.0.1');
                                                                                                                                                                                                  +
                                                                                                                                                                                                  +// new
                                                                                                                                                                                                  +$server = new Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                  +

                                                                                                                                                                                                  Trying to start listening on (DNS) host names will now throw an
                                                                                                                                                                                                  +InvalidArgumentException, use IP addresses instead:

                                                                                                                                                                                                  +
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  +$server = new Server($loop);
                                                                                                                                                                                                  +$server->listen(8080, 'localhost');
                                                                                                                                                                                                  +
                                                                                                                                                                                                  +// new
                                                                                                                                                                                                  +$server = new Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                  +

                                                                                                                                                                                                  If trying to listen fails (such as if port is already in use or port below
                                                                                                                                                                                                  +1024 may require root access etc.), it will now throw a RuntimeException,
                                                                                                                                                                                                  +the ConnectionException class has been removed:

                                                                                                                                                                                                  +
                                                                                                                                                                                                  // old: throws React\Socket\ConnectionException
                                                                                                                                                                                                  +$server = new Server($loop);
                                                                                                                                                                                                  +$server->listen(80);
                                                                                                                                                                                                  +
                                                                                                                                                                                                  +// new: throws RuntimeException
                                                                                                                                                                                                  +$server = new Server(80, $loop);
                                                                                                                                                                                                  +
                                                                                                                                                                                                • +
                                                                                                                                                                                                • +

                                                                                                                                                                                                  Feature / BC break: Rename shutdown() to close() for consistency throughout React
                                                                                                                                                                                                  +(#62 by @clue)

                                                                                                                                                                                                  +
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  +$server->shutdown();
                                                                                                                                                                                                  +
                                                                                                                                                                                                  +// new
                                                                                                                                                                                                  +$server->close();
                                                                                                                                                                                                  +
                                                                                                                                                                                                • +
                                                                                                                                                                                                • +

                                                                                                                                                                                                  Feature / BC break: Replace getPort() with getAddress()
                                                                                                                                                                                                  +(#67 by @clue)

                                                                                                                                                                                                  +
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  +echo $server->getPort(); // 8080
                                                                                                                                                                                                  +
                                                                                                                                                                                                  +// new
                                                                                                                                                                                                  +echo $server->getAddress(); // 127.0.0.1:8080
                                                                                                                                                                                                  +
                                                                                                                                                                                                • +
                                                                                                                                                                                                • +

                                                                                                                                                                                                  Feature / BC break: getRemoteAddress() returns full address instead of only IP
                                                                                                                                                                                                  +(#65 by @clue)

                                                                                                                                                                                                  +
                                                                                                                                                                                                  // old
                                                                                                                                                                                                  +echo $connection->getRemoteAddress(); // 192.168.0.1
                                                                                                                                                                                                  +
                                                                                                                                                                                                  +// new
                                                                                                                                                                                                  +echo $connection->getRemoteAddress(); // 192.168.0.1:51743
                                                                                                                                                                                                  +
                                                                                                                                                                                                • +
                                                                                                                                                                                                • +

                                                                                                                                                                                                  Feature / BC break: Add getLocalAddress() method
                                                                                                                                                                                                  +(#68 by @clue)

                                                                                                                                                                                                  +
                                                                                                                                                                                                  echo $connection->getLocalAddress(); // 127.0.0.1:8080
                                                                                                                                                                                                  +
                                                                                                                                                                                                • +
                                                                                                                                                                                                • +

                                                                                                                                                                                                  BC break: The Server and SecureServer class are now marked final
                                                                                                                                                                                                  +and you can no longer extend them
                                                                                                                                                                                                  (which was never documented or recommended anyway).
                                                                                                                                                                                                  Public properties and event handlers are now internal only.
                                                                                                                                                                                                  Please use composition instead of extension.
                                                                                                                                                                                                  -(#71, #70 and #69 by @clue)

                                                                                                                                                                                                  +(#71, #70 and #69 by @clue)

                                                                                                                                                                                                @@ -7978,45 +3570,45 @@

                                                                                                                                                                                                -
                                                                                                                                                                                                  +
                                                                                                                                                                                                  • -

                                                                                                                                                                                                    Feature: Add request header accessors (à la PSR-7)
                                                                                                                                                                                                    -(#103 by @clue)

                                                                                                                                                                                                    -
                                                                                                                                                                                                    // get value of host header
                                                                                                                                                                                                    -$host = $request->getHeaderLine('Host');
                                                                                                                                                                                                    -
                                                                                                                                                                                                    -// get list of all cookie headers
                                                                                                                                                                                                    -$cookies = $request->getHeader('Cookie');
                                                                                                                                                                                                    +

                                                                                                                                                                                                    Feature: Add request header accessors (à la PSR-7)
                                                                                                                                                                                                    +(#103 by @clue)

                                                                                                                                                                                                    +
                                                                                                                                                                                                    // get value of host header
                                                                                                                                                                                                    +$host = $request->getHeaderLine('Host');
                                                                                                                                                                                                    +
                                                                                                                                                                                                    +// get list of all cookie headers
                                                                                                                                                                                                    +$cookies = $request->getHeader('Cookie');
                                                                                                                                                                                                  • -

                                                                                                                                                                                                    Feature: Forward pause() and resume() from Request to underlying connection
                                                                                                                                                                                                    -(#110 by @clue)

                                                                                                                                                                                                    -
                                                                                                                                                                                                    // support back-pressure when piping request into slower destination
                                                                                                                                                                                                    -$request->pipe($dest);
                                                                                                                                                                                                    -
                                                                                                                                                                                                    -// manually pause/resume request
                                                                                                                                                                                                    -$request->pause();
                                                                                                                                                                                                    -$request->resume();
                                                                                                                                                                                                    +

                                                                                                                                                                                                    Feature: Forward pause() and resume() from Request to underlying connection
                                                                                                                                                                                                    +(#110 by @clue)

                                                                                                                                                                                                    +
                                                                                                                                                                                                    // support back-pressure when piping request into slower destination
                                                                                                                                                                                                    +$request->pipe($dest);
                                                                                                                                                                                                    +
                                                                                                                                                                                                    +// manually pause/resume request
                                                                                                                                                                                                    +$request->pause();
                                                                                                                                                                                                    +$request->resume();
                                                                                                                                                                                                  • -

                                                                                                                                                                                                    Fix: Fix 100-continue to be handled case-insensitive and ignore it for HTTP/1.0.
                                                                                                                                                                                                    +

                                                                                                                                                                                                    Fix: Fix 100-continue to be handled case-insensitive and ignore it for HTTP/1.0.
                                                                                                                                                                                                    Similarly, outgoing response headers are now handled case-insensitive, e.g
                                                                                                                                                                                                    -we no longer apply chunked transfer encoding with mixed-case Content-Length.
                                                                                                                                                                                                    -(#107 by @clue)

                                                                                                                                                                                                    -
                                                                                                                                                                                                    // now handled case-insensitive
                                                                                                                                                                                                    -$request->expectsContinue();
                                                                                                                                                                                                    -
                                                                                                                                                                                                    -// now works just like properly-cased header
                                                                                                                                                                                                    -$response->writeHead($status, array('content-length' => 0));
                                                                                                                                                                                                    +we no longer apply chunked transfer encoding with mixed-case Content-Length.
                                                                                                                                                                                                    +(#107 by @clue)

                                                                                                                                                                                                    +
                                                                                                                                                                                                    // now handled case-insensitive
                                                                                                                                                                                                    +$request->expectsContinue();
                                                                                                                                                                                                    +
                                                                                                                                                                                                    +// now works just like properly-cased header
                                                                                                                                                                                                    +$response->writeHead($status, array('content-length' => 0));
                                                                                                                                                                                                  • -

                                                                                                                                                                                                    Fix: Do not emit empty data events and ignore empty writes in order to
                                                                                                                                                                                                    +

                                                                                                                                                                                                    Fix: Do not emit empty data events and ignore empty writes in order to
                                                                                                                                                                                                    not mess up chunked transfer encoding
                                                                                                                                                                                                    -(#108 and #112 by @clue)

                                                                                                                                                                                                    +(#108 and #112 by @clue)

                                                                                                                                                                                                  • -

                                                                                                                                                                                                    Lock and test minimum required dependency versions and support PHPUnit v5
                                                                                                                                                                                                    -(#113, #115 and #114 by @andig)

                                                                                                                                                                                                    +

                                                                                                                                                                                                    Lock and test minimum required dependency versions and support PHPUnit v5
                                                                                                                                                                                                    +(#113, #115 and #114 by @andig)

                                                                                                                                                                                                  @@ -8035,11 +3627,11 @@

                                                                                                                                                                                                  -
                                                                                                                                                                                                    +
                                                                                                                                                                                                    • Fix: Fix handling connection and stream errors
                                                                                                                                                                                                      -(#45 by @clue)
                                                                                                                                                                                                    • +(#45 by @clue)
                                                                                                                                                                                                    • Feature: Add examples and forward compatibility with upcoming Socket v0.5 component
                                                                                                                                                                                                      -(#46 and #47 by @clue)
                                                                                                                                                                                                    • +(#46 and #47 by @clue)

                                                                                                                                                                                                    @@ -8057,17 +3649,17 @@

                                                                                                                                                                                                    -
                                                                                                                                                                                                      +
                                                                                                                                                                                                      @@ -8085,13 +3677,13 @@

                                                                                                                                                                                                      -
                                                                                                                                                                                                        -
                                                                                                                                                                                                      • Feature: Support socket context options passed to Server
                                                                                                                                                                                                        -(#64 by @clue)
                                                                                                                                                                                                      • -
                                                                                                                                                                                                      • Fix: Properly return null for unknown addresses
                                                                                                                                                                                                        -(#63 by @clue)
                                                                                                                                                                                                      • -
                                                                                                                                                                                                      • Improve documentation for ServerInterface and lock test suite requirements
                                                                                                                                                                                                        -(#60 by @clue, #57 by @shaunbramley)
                                                                                                                                                                                                      • +
                                                                                                                                                                                                          +
                                                                                                                                                                                                        • Feature: Support socket context options passed to Server
                                                                                                                                                                                                          +(#64 by @clue)
                                                                                                                                                                                                        • +
                                                                                                                                                                                                        • Fix: Properly return null for unknown addresses
                                                                                                                                                                                                          +(#63 by @clue)
                                                                                                                                                                                                        • +
                                                                                                                                                                                                        • Improve documentation for ServerInterface and lock test suite requirements
                                                                                                                                                                                                          +(#60 by @clue, #57 by @shaunbramley)

                                                                                                                                                                                                        @@ -8109,13 +3701,13 @@

                                                                                                                                                                                                        -
                                                                                                                                                                                                          -
                                                                                                                                                                                                        • Feature: The Buffer can now be injected into the Stream (or be used standalone)
                                                                                                                                                                                                          -(#62 by @clue)
                                                                                                                                                                                                        • -
                                                                                                                                                                                                        • Fix: Forward close event only once for CompositeStream and ThroughStream
                                                                                                                                                                                                          -(#60 by @clue)
                                                                                                                                                                                                        • -
                                                                                                                                                                                                        • Fix: Consistent close event behavior for Buffer
                                                                                                                                                                                                          -(#61 by @clue)
                                                                                                                                                                                                        • +
                                                                                                                                                                                                            +
                                                                                                                                                                                                          • Feature: The Buffer can now be injected into the Stream (or be used standalone)
                                                                                                                                                                                                            +(#62 by @clue)
                                                                                                                                                                                                          • +
                                                                                                                                                                                                          • Fix: Forward close event only once for CompositeStream and ThroughStream
                                                                                                                                                                                                            +(#60 by @clue)
                                                                                                                                                                                                          • +
                                                                                                                                                                                                          • Fix: Consistent close event behavior for Buffer
                                                                                                                                                                                                            +(#61 by @clue)

                                                                                                                                                                                                          @@ -8133,11 +3725,11 @@

                                                                                                                                                                                                          -
                                                                                                                                                                                                            -
                                                                                                                                                                                                          • Fix: Properly format IPv6 addresses and return null for unknown addresses
                                                                                                                                                                                                            -(#14 by @clue)
                                                                                                                                                                                                          • +
                                                                                                                                                                                                              +
                                                                                                                                                                                                            • Fix: Properly format IPv6 addresses and return null for unknown addresses
                                                                                                                                                                                                              +(#14 by @clue)
                                                                                                                                                                                                            • Fix: Skip IPv6 tests if not supported by the system
                                                                                                                                                                                                              -(#15 by @clue)
                                                                                                                                                                                                            • +(#15 by @clue)

                                                                                                                                                                                                            @@ -8155,11 +3747,11 @@

                                                                                                                                                                                                            -
                                                                                                                                                                                                              -
                                                                                                                                                                                                            • Feature: Add SecureServer for secure TLS connections
                                                                                                                                                                                                              -(#55 by @clue)
                                                                                                                                                                                                            • +
                                                                                                                                                                                                                +
                                                                                                                                                                                                              • Feature: Add SecureServer for secure TLS connections
                                                                                                                                                                                                                +(#55 by @clue)
                                                                                                                                                                                                              • Add functional integration tests
                                                                                                                                                                                                                -(#54 by @clue)
                                                                                                                                                                                                              • +(#54 by @clue)

                                                                                                                                                                                                              @@ -8182,11 +3774,11 @@

                                                                                                                                                                                                              -

                                                                                                                                                                                                              This is a compatibility release that eases upgrading to the v0.4 release branch.
                                                                                                                                                                                                              +

                                                                                                                                                                                                              This is a compatibility release that eases upgrading to the v0.4 release branch.
                                                                                                                                                                                                              You should consider upgrading to the v0.4 release branch.

                                                                                                                                                                                                              -
                                                                                                                                                                                                                +
                                                                                                                                                                                                                • Feature: Cap min timer interval at 1µs, thus improving compatibility with v0.4
                                                                                                                                                                                                                  -(#47 by @clue)
                                                                                                                                                                                                                • +(#47 by @clue)

                                                                                                                                                                                                                @@ -8204,31 +3796,9 @@

                                                                                                                                                                                                                -
                                                                                                                                                                                                                  -
                                                                                                                                                                                                                • Improve test suite to use PSR-4 autoloader and proper namespaces.
                                                                                                                                                                                                                  -(#21 by @clue)
                                                                                                                                                                                                                • -
                                                                                                                                                                                                                - -
                                                                                                                                                                                                                - -

                                                                                                                                                                                                                - - - SocketClient 0.5.3 - - - (2016-12-24) - - Release on GitHub - - -

                                                                                                                                                                                                                -
                                                                                                                                                                                                                  -
                                                                                                                                                                                                                • Fix: Skip IPv6 tests if not supported by the system
                                                                                                                                                                                                                  -(#76 by @clue)
                                                                                                                                                                                                                • -
                                                                                                                                                                                                                • Documentation for ConnectorInterface
                                                                                                                                                                                                                  -(#77 by @clue)
                                                                                                                                                                                                                • +
                                                                                                                                                                                                                • Improve test suite to use PSR-4 autoloader and proper namespaces.
                                                                                                                                                                                                                  +(#21 by @clue)

                                                                                                                                                                                                                @@ -8246,50 +3816,28 @@

                                                                                                                                                                                                                -
                                                                                                                                                                                                                  +
                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                    Revert automatic cancellation of pending collection promises once the output promise resolves. This was introduced in 42d86b7 (PR #36, released in v2.3.0) and was both unintended and backward incompatible.

                                                                                                                                                                                                                    -

                                                                                                                                                                                                                    If you need automatic cancellation, you can use something like:

                                                                                                                                                                                                                    -
                                                                                                                                                                                                                    function allAndCancel(array $promises)
                                                                                                                                                                                                                    -{
                                                                                                                                                                                                                    -     return \React\Promise\all($promises)
                                                                                                                                                                                                                    -         ->always(function() use ($promises) {
                                                                                                                                                                                                                    -             foreach ($promises as $promise) {
                                                                                                                                                                                                                    -                 if ($promise instanceof \React\Promise\CancellablePromiseInterface) {
                                                                                                                                                                                                                    -                     $promise->cancel();
                                                                                                                                                                                                                    -                 }
                                                                                                                                                                                                                    -             }
                                                                                                                                                                                                                    -        });
                                                                                                                                                                                                                    -}
                                                                                                                                                                                                                    +

                                                                                                                                                                                                                    Revert automatic cancellation of pending collection promises once the output promise resolves. This was introduced in 42d86b7 (PR #36, released in v2.3.0) and was both unintended and backward incompatible.

                                                                                                                                                                                                                    +

                                                                                                                                                                                                                    If you need automatic cancellation, you can use something like:

                                                                                                                                                                                                                    +
                                                                                                                                                                                                                    function allAndCancel(array $promises)
                                                                                                                                                                                                                    +{
                                                                                                                                                                                                                    +     return \React\Promise\all($promises)
                                                                                                                                                                                                                    +         ->always(function() use ($promises) {
                                                                                                                                                                                                                    +             foreach ($promises as $promise) {
                                                                                                                                                                                                                    +                 if ($promise instanceof \React\Promise\CancellablePromiseInterface) {
                                                                                                                                                                                                                    +                     $promise->cancel();
                                                                                                                                                                                                                    +                 }
                                                                                                                                                                                                                    +             }
                                                                                                                                                                                                                    +        });
                                                                                                                                                                                                                    +}
                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                    all() and map() functions now preserve the order of the array (#77).

                                                                                                                                                                                                                    +

                                                                                                                                                                                                                    all() and map() functions now preserve the order of the array (#77).

                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                    Fix circular references when resolving a promise with itself (#71).

                                                                                                                                                                                                                    +

                                                                                                                                                                                                                    Fix circular references when resolving a promise with itself (#71).

                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                  - -
                                                                                                                                                                                                                  - -

                                                                                                                                                                                                                  - - - SocketClient 0.5.2 - - - (2016-12-19) - - Release on GitHub - - -

                                                                                                                                                                                                                  - -
                                                                                                                                                                                                                    -
                                                                                                                                                                                                                  • Feature: Replace SecureStream with unlimited read buffer from react/stream v0.4.5
                                                                                                                                                                                                                    -(#72 by @clue)
                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                  • Feature: Add examples
                                                                                                                                                                                                                    -(#75 by @clue)

                                                                                                                                                                                                                  @@ -8307,35 +3855,13 @@

                                                                                                                                                                                                                  -
                                                                                                                                                                                                                    -
                                                                                                                                                                                                                  • Feature / Fix: ConnectionInterface should extend DuplexStreamInterface + documentation
                                                                                                                                                                                                                    -(#50 by @clue)
                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                      +
                                                                                                                                                                                                                    • Feature / Fix: ConnectionInterface should extend DuplexStreamInterface + documentation
                                                                                                                                                                                                                      +(#50 by @clue)
                                                                                                                                                                                                                    • Feature / Fix: Improve test suite and switch to normal stream handler
                                                                                                                                                                                                                      -(#51 by @clue)
                                                                                                                                                                                                                    • +(#51 by @clue)
                                                                                                                                                                                                                    • Feature: Add examples
                                                                                                                                                                                                                      -(#49 by @clue)
                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                    - - - SocketClient 0.4.6 - - - (2016-12-06) - - Release on GitHub - - -

                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                    This is a bugfix release that resolves an issue introduced in the v0.4.5 release.
                                                                                                                                                                                                                    -You should consider upgrading to the v0.5 release.

                                                                                                                                                                                                                    -
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                    • Fix: Always create empty stream context to prevent race condition leading to
                                                                                                                                                                                                                      -CN mismatch on TLS enabled connections (#73 by @WyriHaximus)
                                                                                                                                                                                                                    • +(#49 by @clue)

                                                                                                                                                                                                                    @@ -8343,7 +3869,7 @@

                                                                                                                                                                                                                    - HttpClient 0.4.15 + HTTPClient 0.4.15 (2016-12-02) @@ -8353,42 +3879,9 @@

                                                                                                                                                                                                                    -
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                    • Improvement: Add examples #69 @clue
                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                    • Fix: Ensure checking for 0 length chunk, when we should check for it #71 @WyriHaximus
                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                    - - - SocketClient 0.5.1 - - - (2016-11-20) - - Release on GitHub - - -

                                                                                                                                                                                                                    -
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                      Feature: Support Promise cancellation for all connectors
                                                                                                                                                                                                                      -(#71 by @clue)

                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      $promise = $connector->create($host, $port);
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      -$promise->cancel();
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                      Feature: Add TimeoutConnector decorator
                                                                                                                                                                                                                      -(#51 by @clue)

                                                                                                                                                                                                                      -
                                                                                                                                                                                                                      $timeout = new TimeoutConnector($connector, 3.0, $loop);
                                                                                                                                                                                                                      -$timeout->create($host, $port)->then(function(Stream $stream) {
                                                                                                                                                                                                                      -    // connection resolved within 3.0s
                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                    • Improvement: Add examples #69 @clue
                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                    • Fix: Ensure checking for 0 length chunk, when we should check for it #71 @WyriHaximus

                                                                                                                                                                                                                    @@ -8406,15 +3899,15 @@

                                                                                                                                                                                                                    -
                                                                                                                                                                                                                      -
                                                                                                                                                                                                                    • Feature: Support setting read buffer size to null (infinite)
                                                                                                                                                                                                                      -(#42 by @clue)
                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                    • Fix: Do not emit full-drain event if Buffer is closed during drain event
                                                                                                                                                                                                                      -(#55 by @clue)
                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                        +
                                                                                                                                                                                                                      • Feature: Support setting read buffer size to null (infinite)
                                                                                                                                                                                                                        +(#42 by @clue)
                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                      • Fix: Do not emit full-drain event if Buffer is closed during drain event
                                                                                                                                                                                                                        +(#55 by @clue)
                                                                                                                                                                                                                      • Vastly improved performance by factor of 10x to 20x.
                                                                                                                                                                                                                        Raise default buffer sizes to 64 KiB and simplify and improve error handling
                                                                                                                                                                                                                        and unneeded function calls.
                                                                                                                                                                                                                        -(#53, #55, #56 by @clue)
                                                                                                                                                                                                                      • +(#53, #55, #56 by @clue)

                                                                                                                                                                                                                      @@ -8432,12 +3925,12 @@

                                                                                                                                                                                                                      -
                                                                                                                                                                                                                        -
                                                                                                                                                                                                                      • Remove all listeners after emitting error in RequestHeaderParser #68 @WyriHaximus
                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                      • Catch Guzzle parse request errors #65 @WyriHaximus
                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                      • Remove branch-alias definition as per reactphp/reactphp#343 #58 @WyriHaximus
                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                      • Add functional example to ease getting started #64 by @clue
                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                      • Naming, immutable array manipulation #37 @cboden
                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                        @@ -8445,7 +3938,7 @@

                                                                                                                                                                                                                        - HttpClient 0.4.14 + HTTPClient 0.4.14 (2016-10-28) @@ -8455,8 +3948,8 @@

                                                                                                                                                                                                                        -
                                                                                                                                                                                                                          -
                                                                                                                                                                                                                        • Fix: Ensure the first bit of body directly after the headers is emitted into the stream #68 @WyriHaximus
                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                            +
                                                                                                                                                                                                                          • Fix: Ensure the first bit of body directly after the headers is emitted into the stream #68 @WyriHaximus

                                                                                                                                                                                                                          @@ -8464,7 +3957,7 @@

                                                                                                                                                                                                                          - HttpClient 0.4.13 + HTTPClient 0.4.13 (2016-10-19) @@ -8474,8 +3967,8 @@

                                                                                                                                                                                                                          -
                                                                                                                                                                                                                            -
                                                                                                                                                                                                                          • Fix: Ensure Request emits initial Response data as string #66 @mmelvin0
                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                              +
                                                                                                                                                                                                                            • Fix: Ensure Request emits initial Response data as string #66 @mmelvin0

                                                                                                                                                                                                                            @@ -8483,7 +3976,7 @@

                                                                                                                                                                                                                            - HttpClient 0.4.12 + HTTPClient 0.4.12 (2016-10-06) @@ -8493,8 +3986,8 @@

                                                                                                                                                                                                                            -
                                                                                                                                                                                                                              -
                                                                                                                                                                                                                            • Fix: Changed $stream from DuplexStreamInterface to ReadableStreamInterface in Response constructor #63 @WyriHaximus
                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                +
                                                                                                                                                                                                                              • Fix: Changed $stream from DuplexStreamInterface to ReadableStreamInterface in Response constructor #63 @WyriHaximus

                                                                                                                                                                                                                              @@ -8502,7 +3995,7 @@

                                                                                                                                                                                                                              - HttpClient 0.4.11 + HTTPClient 0.4.11 (2016-09-15) @@ -8512,8 +4005,8 @@

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                -
                                                                                                                                                                                                                              • Feature: Chunked encoding @WyriHaximus
                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                @@ -8531,16 +4024,16 @@

                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                • Bug fix: Emit error event and close Stream when accessing the underlying
                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                  • Bug fix: Emit error event and close Stream when accessing the underlying
                                                                                                                                                                                                                                    stream resource fails with a permanent error.
                                                                                                                                                                                                                                    -(#52 and #40 by @clue, #25 by @lysenkobv)
                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                  • Bug fix: Do not emit empty data event if nothing has been read (stream reached EOF)
                                                                                                                                                                                                                                    -(#39 by @clue)
                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                  • Bug fix: Ignore empty writes to Buffer
                                                                                                                                                                                                                                    -(#51 by @clue)
                                                                                                                                                                                                                                  • +(#52 and #40 by @clue, #25 by @lysenkobv) +
                                                                                                                                                                                                                                  • Bug fix: Do not emit empty data event if nothing has been read (stream reached EOF)
                                                                                                                                                                                                                                    +(#39 by @clue)
                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                  • Bug fix: Ignore empty writes to Buffer
                                                                                                                                                                                                                                    +(#51 by @clue)
                                                                                                                                                                                                                                  • Add benchmarking script to measure throughput in CI
                                                                                                                                                                                                                                    -(#41 by @clue)
                                                                                                                                                                                                                                  • +(#41 by @clue)

                                                                                                                                                                                                                                  @@ -8558,11 +4051,11 @@

                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                    • Standalone component
                                                                                                                                                                                                                                    • Test against PHP 7 and HHVM, report test coverage, AppVeyor tests
                                                                                                                                                                                                                                    • Fix: Wait for stdout and stderr to close before watching for process exit
                                                                                                                                                                                                                                      -(#18 by @mbonneau)
                                                                                                                                                                                                                                    • +(#18 by @mbonneau)

                                                                                                                                                                                                                                    @@ -8580,19 +4073,19 @@

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                        Feature: Allow for cache adapter injection (#38 by @WyriHaximus)

                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                        $factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                        -$cache = new MyCustomCacheInstance();
                                                                                                                                                                                                                                        -$resolver = $factory->createCached('8.8.8.8', $loop, $cache);
                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                        Feature: Allow for cache adapter injection (#38 by @WyriHaximus)

                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                        $factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                        +$cache = new MyCustomCacheInstance();
                                                                                                                                                                                                                                        +$resolver = $factory->createCached('8.8.8.8', $loop, $cache);
                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                        Feature: Support Promise cancellation (#35 by @clue)

                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                        $promise = $resolver->resolve('reactphp.org');
                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                        -$promise->cancel();
                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                        Feature: Support Promise cancellation (#35 by @clue)

                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                        $promise = $resolver->resolve('reactphp.org');
                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                        +$promise->cancel();
                                                                                                                                                                                                                                      @@ -8611,8 +4104,8 @@

                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                      • Fix some() not cancelling pending promises when too much input promises reject (16ff799).
                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                        • Fix some() not cancelling pending promises when too much input promises reject (16ff799).

                                                                                                                                                                                                                                        @@ -8630,32 +4123,10 @@

                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                        • Support foreign thenables in resolve().
                                                                                                                                                                                                                                          -Any object that provides a then() method is now assimilated to a trusted promise that follows the state of this thenable (#52).
                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                        • Fix some() and any() for input arrays containing not enough items (#34).
                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                        - -
                                                                                                                                                                                                                                        - -

                                                                                                                                                                                                                                        - - - SocketClient 0.4.5 - - - (2016-03-27) - - Release on GitHub - - -

                                                                                                                                                                                                                                        - -

                                                                                                                                                                                                                                        This is a compatibility release that backports some changes from the v0.5
                                                                                                                                                                                                                                        -release branch. You should consider upgrading to the v0.5 release.

                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                        • Fix: PHP 5.6+ uses new SSL/TLS context options backported (#65 by @clue)
                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                        • Fix: Move SSL/TLS context options to SecureConnector (#43 by @clue)
                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                          • Support foreign thenables in resolve().
                                                                                                                                                                                                                                            +Any object that provides a then() method is now assimilated to a trusted promise that follows the state of this thenable (#52).
                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                          • Fix some() and any() for input arrays containing not enough items (#34).

                                                                                                                                                                                                                                          @@ -8673,9 +4144,9 @@

                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                          • Allow cancellation of promises returned by functions working on promise collections (#36).
                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                          • Handle \Throwable in the same way as \Exception (#51 by @joshdifabio).
                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                            • Allow cancellation of promises returned by functions working on promise collections (#36).
                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                            • Handle \Throwable in the same way as \Exception (#51 by @joshdifabio).

                                                                                                                                                                                                                                            @@ -8683,7 +4154,7 @@

                                                                                                                                                                                                                                            - HttpClient 0.3.2 + HTTPClient 0.3.2 (2016-03-24) @@ -8693,9 +4164,9 @@

                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                            • Improvement: Broader guzzle/parser version req @cboden
                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                            • Improvement: Improve forwards compatibility with all supported versions @clue
                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                              • Improvement: Broader guzzle/parser version req @cboden
                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                              • Improvement: Improve forwards compatibility with all supported versions @clue

                                                                                                                                                                                                                                              @@ -8703,7 +4174,7 @@

                                                                                                                                                                                                                                              - HttpClient 0.4.10 + HTTPClient 0.4.10 (2016-03-21) @@ -8713,72 +4184,8 @@

                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                              • Improvement: Update react/socket-client dependency to all supported versions @clue
                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                              - - - SocketClient 0.5.0 - - - (2016-03-19) - - Release on GitHub - - -

                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                Feature / BC break: Support Connector without DNS
                                                                                                                                                                                                                                                -(#46 by @clue)

                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                BC break: The Connector class now serves as a BC layer only.
                                                                                                                                                                                                                                                -The TcpConnector and DnsConnector classes replace its functionality.
                                                                                                                                                                                                                                                -If you're merely using this class, then you're recommended to upgrade as
                                                                                                                                                                                                                                                -per the below snippet – existing code will still work unchanged.
                                                                                                                                                                                                                                                -If you're extending the Connector (generally not recommended), then you
                                                                                                                                                                                                                                                -may have to rework your class hierarchy.

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                // old (still supported, but marked deprecated)
                                                                                                                                                                                                                                                -$connector = new Connector($loop, $resolver);
                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                -// new equivalent
                                                                                                                                                                                                                                                -$connector = new DnsConnector(new TcpConnector($loop), $resolver);
                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                -// new feature: supports connecting to IP addresses only
                                                                                                                                                                                                                                                -$connector = new TcpConnector($loop);
                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                Feature: Add socket and SSL/TLS context options to connectors
                                                                                                                                                                                                                                                -(#52 by @clue)

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                Fix: PHP 5.6+ uses new SSL/TLS context options
                                                                                                                                                                                                                                                -(#61 by @clue)

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                Fix: Move SSL/TLS context options to SecureConnector
                                                                                                                                                                                                                                                -(#43 by @clue)

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                Fix: Fix error reporting for invalid addresses
                                                                                                                                                                                                                                                -(#47 by @clue)

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                Fix: Close stream resource if connection fails
                                                                                                                                                                                                                                                -(#48 by @clue)

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                First class support for PHP 5.3 through PHP 7 and HHVM
                                                                                                                                                                                                                                                -(#53, #54 by @clue)

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                Add integration tests for SSL/TLS sockets
                                                                                                                                                                                                                                                -(#62 by @clue)

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                              • Improvement: Update react/socket-client dependency to all supported versions @clue

                                                                                                                                                                                                                                              @@ -8796,13 +4203,13 @@

                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                • Feature: Support promise cancellation (cancellation of underlying DNS lookup)
                                                                                                                                                                                                                                                  -(#12 by @clue)
                                                                                                                                                                                                                                                • +(#12 by @clue)
                                                                                                                                                                                                                                                • Fix: Fix error reporting when trying to create invalid sockets
                                                                                                                                                                                                                                                  -(#11 by @clue)
                                                                                                                                                                                                                                                • +(#11 by @clue)
                                                                                                                                                                                                                                                • Improve test suite and update dependencies
                                                                                                                                                                                                                                                  -(#7, #8 by @clue)
                                                                                                                                                                                                                                                • +(#7, #8 by @clue)

                                                                                                                                                                                                                                                @@ -8810,7 +4217,7 @@

                                                                                                                                                                                                                                                - HttpClient 0.4.9 + HTTPClient 0.4.9 (2016-03-08) @@ -8820,9 +4227,9 @@

                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                • Improvement: PHP 7 memory leak, related to PHP bug 71737 @jmalloc
                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                • Improvement: Clean up all listeners when closing request @weichenlin
                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                  • Improvement: PHP 7 memory leak, related to PHP bug 71737 @jmalloc
                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                  • Improvement: Clean up all listeners when closing request @weichenlin

                                                                                                                                                                                                                                                  @@ -8840,11 +4247,11 @@

                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                    • Bug fix: No longer error when signals sent to StreamSelectLoop
                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                    • Support HHVM and PHP7 (@ondrejmirtes, @cebe)
                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                    • Feature: Added support for EventConfig for ExtEventLoop (@steverhoades)
                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                    • Bug fix: Fixed an issue loading loop extension libs via autoloader (@czarpino)
                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                    • Support HHVM and PHP7 (@ondrejmirtes, @cebe)
                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                    • Feature: Added support for EventConfig for ExtEventLoop (@steverhoades)
                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                    • Bug fix: Fixed an issue loading loop extension libs via autoloader (@czarpino)

                                                                                                                                                                                                                                                    @@ -8862,8 +4269,8 @@

                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                    • Fix DeferredPromise to also implement the CancellablePromiseInterface.
                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                      • Fix DeferredPromise to also implement the CancellablePromiseInterface.

                                                                                                                                                                                                                                                      @@ -8881,7 +4288,7 @@

                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                        • Suppress errors on stream_socket_accept to prevent PHP from crashing
                                                                                                                                                                                                                                                        • Support for PHP7 and HHVM
                                                                                                                                                                                                                                                        • Support PHP 5.3 again
                                                                                                                                                                                                                                                        • @@ -8902,9 +4309,9 @@

                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                            • Feature: Support promise cancellation for all timer primitives
                                                                                                                                                                                                                                                              -(#18 by @clue)
                                                                                                                                                                                                                                                            • +(#18 by @clue)

                                                                                                                                                                                                                                                            @@ -8922,8 +4329,8 @@

                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                            This release makes the API more compatible with 2.0 while preserving full backward compatibility.

                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                              This release makes the API more compatible with 2.0 while preserving full backward compatibility.

                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                              • Introduce new CancellablePromiseInterface implemented by all promises.
                                                                                                                                                                                                                                                              • Add new .cancel() method (part of the CancellablePromiseInterface).
                                                                                                                                                                                                                                                              @@ -8943,8 +4350,8 @@

                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                              • Fix cancellation handlers called multiple times (#47 by @clue).
                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                • Fix cancellation handlers called multiple times (#47 by @clue).

                                                                                                                                                                                                                                                                @@ -8962,10 +4369,10 @@

                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                  • Repository maintenance, split off from main repo, improve test suite and documentation
                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                  • First class support for PHP7 and HHVM (#9 by @clue)
                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                  • Adjust compatibility to 5.3 (#7 by @clue)
                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                  • First class support for PHP7 and HHVM (#9 by @clue)
                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                  • Adjust compatibility to 5.3 (#7 by @clue)

                                                                                                                                                                                                                                                                  @@ -8983,10 +4390,10 @@

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                    • Repository maintenance, split off from main repo, improve test suite and documentation
                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                    • First class support for PHP7 and HHVM (#34 by @clue)
                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                    • Adjust compatibility to 5.3 (#30 by @clue)
                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                    • First class support for PHP7 and HHVM (#34 by @clue)
                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                    • Adjust compatibility to 5.3 (#30 by @clue)

                                                                                                                                                                                                                                                                    @@ -9009,9 +4416,9 @@

                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                      • Fix: Correct formatting for remote peer address of incoming datagrams when using IPv6
                                                                                                                                                                                                                                                                        -(#6 by @WyriHaximus)
                                                                                                                                                                                                                                                                      • +(#6 by @WyriHaximus)
                                                                                                                                                                                                                                                                      • Improve test suite for different PHP versions
                                                                                                                                                                                                                                                                      @@ -9030,11 +4437,11 @@

                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                      • Bug fix: Read buffer to 0 fixes error with libevent and large quantity of I/O (@mbonneau)
                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                      • Bug fix: No double-write during drain call (@arnaud-lb)
                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                      • Bug fix: Support HHVM (@clue)
                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                      • Adjust compatibility to 5.3 (@clue)
                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                        • Bug fix: Read buffer to 0 fixes error with libevent and large quantity of I/O (@mbonneau)
                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                        • Bug fix: No double-write during drain call (@arnaud-lb)
                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                        • Bug fix: Support HHVM (@clue)
                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                        • Adjust compatibility to 5.3 (@clue)

                                                                                                                                                                                                                                                                        @@ -9042,7 +4449,7 @@

                                                                                                                                                                                                                                                                        - HttpClient 0.4.8 + HTTPClient 0.4.8 (2015-10-05) @@ -9052,8 +4459,8 @@

                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                        • Improvement: Avoid hiding exceptions thrown in HttpClient\Request error handlers @arnaud-lb
                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                          • Improvement: Avoid hiding exceptions thrown in HttpClient\Request error handlers @arnaud-lb

                                                                                                                                                                                                                                                                          @@ -9071,7 +4478,7 @@

                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                            • First tagged release
                                                                                                                                                                                                                                                                            @@ -9080,7 +4487,7 @@

                                                                                                                                                                                                                                                                            - HttpClient 0.4.7 + HTTPClient 0.4.7 (2015-09-24) @@ -9090,29 +4497,8 @@

                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                            • Improvement: Set protocol version on request creation @WyriHaximus
                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                            - -
                                                                                                                                                                                                                                                                            - -

                                                                                                                                                                                                                                                                            - - - SocketClient 0.4.4 - - - (2015-09-23) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                            • Feature: Add support for Unix domain sockets (UDS) (#41 by @clue)
                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                            • Bugfix: Explicitly set supported TLS versions for PHP 5.6+ (#31 by @WyriHaximus)
                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                            • Bugfix: Ignore SSL non-draining buffer workaround for PHP 5.6.8+ (#33 by @alexmace)
                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                            • Improvement: Set protocol version on request creation @WyriHaximus

                                                                                                                                                                                                                                                                            @@ -9120,7 +4506,7 @@

                                                                                                                                                                                                                                                                            - HttpClient 0.4.6 + HTTPClient 0.4.6 (2015-09-20) @@ -9130,8 +4516,8 @@

                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                            • Improvement: Support explicitly using HTTP/1.1 protocol version @clue
                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                              • Improvement: Support explicitly using HTTP/1.1 protocol version @clue

                                                                                                                                                                                                                                                                              @@ -9139,7 +4525,7 @@

                                                                                                                                                                                                                                                                              - HttpClient 0.4.5 + HTTPClient 0.4.5 (2015-08-31) @@ -9149,8 +4535,8 @@

                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                              • Improvement: Replaced the abandoned guzzle/parser with guzzlehttp/psr7 @WyriHaximus
                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                • Improvement: Replaced the abandoned guzzle/parser with guzzlehttp/psr7 @WyriHaximus

                                                                                                                                                                                                                                                                                @@ -9168,7 +4554,7 @@

                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                  • Fix stack error when resolving a promise in its own fulfillment or rejection handlers.
                                                                                                                                                                                                                                                                                  @@ -9187,10 +4573,10 @@

                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                  This release makes the API more compatible with 2.0 while preserving full backward compatibility.

                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                  • Add React\Promise\Promise class.
                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                  • Move methods of React\Promise\When and React\Promise\Util to functions while keeping the classes as a proxy for BC.
                                                                                                                                                                                                                                                                                  • +

                                                                                                                                                                                                                                                                                    This release makes the API more compatible with 2.0 while preserving full backward compatibility.

                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                    • Add React\Promise\Promise class.
                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                    • Move methods of React\Promise\When and React\Promise\Util to functions while keeping the classes as a proxy for BC.

                                                                                                                                                                                                                                                                                    @@ -9198,7 +4584,7 @@

                                                                                                                                                                                                                                                                                    - HttpClient 0.4.4 + HTTPClient 0.4.4 (2015-06-16) @@ -9208,8 +4594,8 @@

                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                    • Improvement: Emit drain event when the request is ready to receive more data by @arnaud-lb
                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                      • Improvement: Emit drain event when the request is ready to receive more data by @arnaud-lb

                                                                                                                                                                                                                                                                                      @@ -9217,7 +4603,7 @@

                                                                                                                                                                                                                                                                                      - HttpClient 0.4.3 + HTTPClient 0.4.3 (2015-06-15) @@ -9227,8 +4613,8 @@

                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                      • Improvement: Added support for using auth informations from URL by @arnaud-lb
                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                        • Improvement: Added support for using auth informations from URL by @arnaud-lb

                                                                                                                                                                                                                                                                                        @@ -9246,10 +4632,10 @@

                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                        • Replaced guzzle/parser with guzzlehttp/psr7 by @cboden
                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                        • FIX Continue Header by @iannsp
                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                        • Missing type hint by @marenzo
                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                          • Replaced guzzle/parser with guzzlehttp/psr7 by @cboden
                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                          • FIX Continue Header by @iannsp
                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                          • Missing type hint by @marenzo

                                                                                                                                                                                                                                                                                          @@ -9257,7 +4643,7 @@

                                                                                                                                                                                                                                                                                          - HttpClient 0.4.2 + HTTPClient 0.4.2 (2015-05-14) @@ -9267,29 +4653,8 @@

                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                          • Improvement: Pass Response object on with data emit by @dpovshed
                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                          - - - SocketClient 0.4.3 - - - (2015-03-20) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                          • Bugfix: Set peer name to hostname to correct security concern in PHP 5.6 (@WyriHaximus)
                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                          • Bugfix: Always wrap secure to pull buffer due to regression in PHP
                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                          • Bugfix: SecureStream extends Stream to match documentation preventing BC (@clue)
                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                          • Improvement: Pass Response object on with data emit by @dpovshed

                                                                                                                                                                                                                                                                                          @@ -9312,8 +4677,8 @@

                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                          This release introduces the ExtendedPromiseInterface.

                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                          The ExtendedPromiseInterface extends the PromiseInterface with useful shortcut
                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                          This release introduces the ExtendedPromiseInterface.

                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                          The ExtendedPromiseInterface extends the PromiseInterface with useful shortcut
                                                                                                                                                                                                                                                                                          and utility methods which are not part of the Promises/A specification.


                                                                                                                                                                                                                                                                                          @@ -9321,7 +4686,7 @@

                                                                                                                                                                                                                                                                                          - HttpClient 0.4.1 + HTTPClient 0.4.1 (2014-11-23) @@ -9331,9 +4696,9 @@

                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                          • Improvement: Use EventEmitterTrait instead of base class by @cursedcoder
                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                          • Improvement: Changed Stream to DuplexStreamInterface in Response::__construct by @mbonneau
                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                            • Improvement: Use EventEmitterTrait instead of base class by @cursedcoder
                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                            • Improvement: Changed Stream to DuplexStreamInterface in Response::__construct by @mbonneau

                                                                                                                                                                                                                                                                                            @@ -9351,37 +4716,15 @@

                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                              • Initial tagged release
                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                              This project has been migrated over from clue/datagram
                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                              This project has been migrated over from clue/datagram
                                                                                                                                                                                                                                                                                              which has originally been released in January 2013.
                                                                                                                                                                                                                                                                                              -Upgrading from clue/datagram v0.5.0? Use namespace React\Datagram instead of Datagram and you're ready to go!

                                                                                                                                                                                                                                                                                              +Upgrading from clue/datagram v0.5.0? Use namespace React\Datagram instead of Datagram and you're ready to go!

                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                              - - - SocketClient 0.4.2 - - - (2014-10-16) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                              Phergilicious: In honour of all the SSL bugs found by the Phergie project re-writing on top of React.

                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                              @@ -9397,7 +4740,7 @@

                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                              Introduce new CancellablePromiseInterface implemented by all promises.

                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                              Introduce new CancellablePromiseInterface implemented by all promises.


                                                                                                                                                                                                                                                                                              @@ -9414,7 +4757,7 @@

                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                • Added DuplexStreamInterface
                                                                                                                                                                                                                                                                                                • Stream sets stream resources to non-blocking
                                                                                                                                                                                                                                                                                                • Fixed potential race condition in pipe
                                                                                                                                                                                                                                                                                                • @@ -9435,7 +4778,7 @@

                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                  Backwards compatibility release for Reach 0.3.x and PHP 5.3 (see #4).

                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                  Backwards compatibility release for Reach 0.3.x and PHP 5.3 (see #4).


                                                                                                                                                                                                                                                                                                  @@ -9452,7 +4795,7 @@

                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                    • [Connection] Verify stream is valid resource
                                                                                                                                                                                                                                                                                                    @@ -9471,8 +4814,8 @@

                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                    • Bug fix: Check read buffer for data before shutdown signal and end emit (@artydev)
                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                      • Bug fix: Check read buffer for data before shutdown signal and end emit (@artydev)
                                                                                                                                                                                                                                                                                                      • Bug fix: v0.3.4 changes merged for v0.4.1
                                                                                                                                                                                                                                                                                                      @@ -9491,8 +4834,8 @@

                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                      • Bug fix: Fixed PSR-4 autoload path (@marcj/WyriHaximus)
                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                        • Bug fix: Fixed PSR-4 autoload path ()

                                                                                                                                                                                                                                                                                                        @@ -9510,7 +4853,7 @@

                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                          • Bug fix: v0.3.4 changes merged for v0.4.1
                                                                                                                                                                                                                                                                                                          @@ -9529,8 +4872,8 @@

                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                          • Bug fix: null timeout in StreamSelectLoop causing 100% CPU usage (@clue)
                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                            • Bug fix: null timeout in StreamSelectLoop causing 100% CPU usage (@clue)
                                                                                                                                                                                                                                                                                                            • Bug fix: v0.3.4 changes merged for v0.4.1
                                                                                                                                                                                                                                                                                                            @@ -9549,7 +4892,7 @@

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                              • Bug fix: Reset socket to non-blocking after shutting down (PHP bug)
                                                                                                                                                                                                                                                                                                              @@ -9568,7 +4911,7 @@

                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                • Bug fix: [Stream] Fixed 100% CPU spike from non-empty write buffer on closed stream
                                                                                                                                                                                                                                                                                                                @@ -9587,13 +4930,13 @@

                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                • Feature: Added EventLoopInterface::nextTick(), implemented in all event loops (@jmalloc)
                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                • Feature: Added EventLoopInterface::futureTick(), implemented in all event loops (@jmalloc)
                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                • Feature: Added ExtEventLoop implementation using pecl/event (@jmalloc)
                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                  • Feature: Added EventLoopInterface::nextTick(), implemented in all event loops (@jmalloc)
                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                  • Feature: Added EventLoopInterface::futureTick(), implemented in all event loops (@jmalloc)
                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                  • Feature: Added ExtEventLoop implementation using pecl/event (@jmalloc)
                                                                                                                                                                                                                                                                                                                  • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                  • BC break: New method: EventLoopInterface::nextTick()
                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                  • BC break: New method: EventLoopInterface::futureTick()
                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                  • BC break: New method: EventLoopInterface::nextTick()
                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                  • BC break: New method: EventLoopInterface::futureTick()
                                                                                                                                                                                                                                                                                                                  • Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
                                                                                                                                                                                                                                                                                                                  @@ -9612,32 +4955,10 @@

                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                  • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                  • BC break: Update to Evenement 2.0
                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                  • Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                  - -
                                                                                                                                                                                                                                                                                                                  - -

                                                                                                                                                                                                                                                                                                                  - - - SocketClient 0.4.0 - - - (2014-02-02) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                  • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                  • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                  • BC break: Update to Evenement 2.0
                                                                                                                                                                                                                                                                                                                  • Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                  • Bump React dependencies to v0.4

                                                                                                                                                                                                                                                                                                                  @@ -9655,7 +4976,7 @@

                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                    • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                    • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                    • BC break: Update to Evenement 2.0
                                                                                                                                                                                                                                                                                                                    • @@ -9668,7 +4989,7 @@

                                                                                                                                                                                                                                                                                                                      - HttpClient 0.4.0 + HTTPClient 0.4.0 (2014-02-02) @@ -9678,10 +4999,10 @@

                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                      • BC break: Drop unused Response::getBody()
                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                        • BC break: Drop unused Response::getBody()
                                                                                                                                                                                                                                                                                                                        • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                        • BC break: Remove $loop argument from HttpClient: Client, Request, Response
                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                        • BC break: Remove $loop argument from HttpClient: Client, Request, Response
                                                                                                                                                                                                                                                                                                                        • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                        • Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
                                                                                                                                                                                                                                                                                                                        • Bump React dependencies to v0.4
                                                                                                                                                                                                                                                                                                                        • @@ -9702,7 +5023,7 @@

                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                            • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                            • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                            • BC break: Update to Evenement 2.0
                                                                                                                                                                                                                                                                                                                            • @@ -9725,7 +5046,7 @@

                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                                • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                                • Bug fix: Properly resolve CNAME aliases
                                                                                                                                                                                                                                                                                                                                • @@ -9748,8 +5069,8 @@

                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                  • Feature: Added ChildProcess to run async child processes within the event loop (@jmikola)
                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                    • Feature: Added ChildProcess to run async child processes within the event loop (@jmikola)

                                                                                                                                                                                                                                                                                                                                    @@ -9767,7 +5088,7 @@

                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                      • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                                      • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                                      • Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
                                                                                                                                                                                                                                                                                                                                      • @@ -9793,8 +5114,8 @@

                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                        New major release. The goal was to streamline the API and to make it more compliant with other promise libraries and especially with the new upcoming ES6 promises specification.

                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                          New major release. The goal was to streamline the API and to make it more compliant with other promise libraries and especially with the new upcoming ES6 promises specification.

                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                          • Add standalone Promise class.
                                                                                                                                                                                                                                                                                                                                          • Add new React\Promise\race() function.
                                                                                                                                                                                                                                                                                                                                          • BC break: Bump minimum PHP version to PHP 5.4.
                                                                                                                                                                                                                                                                                                                                          • @@ -9820,8 +5141,8 @@

                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                            • Bug fix: Changed StreamSelectLoop to use non-blocking behavior on tick() (@astephens25)
                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                              • Bug fix: Changed StreamSelectLoop to use non-blocking behavior on tick() (@astephens25)

                                                                                                                                                                                                                                                                                                                                              @@ -9839,7 +5160,7 @@

                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                • Bug fix: [Stream] Correctly detect closed connections
                                                                                                                                                                                                                                                                                                                                                @@ -9858,7 +5179,7 @@

                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                  • Version bump
                                                                                                                                                                                                                                                                                                                                                  @@ -9877,9 +5198,9 @@

                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                  • Bug fix: No error on removing non-existent streams (@clue)
                                                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                                                  • Bug fix: Do not silently remove feof listeners in LibEvLoop
                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                    • Bug fix: No error on removing non-existent streams (@clue)
                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                    • Bug fix: Do not silently remove feof listeners in LibEvLoop

                                                                                                                                                                                                                                                                                                                                                    @@ -9897,7 +5218,7 @@

                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                      • Bug fix: [Stream] Make sure CompositeStream is closed properly
                                                                                                                                                                                                                                                                                                                                                      @@ -9916,8 +5237,8 @@

                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                      • Feature: Support default port for IPv6 addresses (@clue)
                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                        • Feature: Support default port for IPv6 addresses (@clue)

                                                                                                                                                                                                                                                                                                                                                        @@ -9935,7 +5256,7 @@

                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                          • Version bump
                                                                                                                                                                                                                                                                                                                                                          @@ -9954,7 +5275,7 @@

                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                            • Version bump
                                                                                                                                                                                                                                                                                                                                                            @@ -9973,8 +5294,8 @@

                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                            • Bug fix: [Stream] Allow any ReadableStreamInterface on BufferedSink::createPromise()
                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                              • Bug fix: [Stream] Allow any ReadableStreamInterface on BufferedSink::createPromise()

                                                                                                                                                                                                                                                                                                                                                              @@ -9982,7 +5303,7 @@

                                                                                                                                                                                                                                                                                                                                                              - HttpClient 0.3.1 + HTTPClient 0.3.1 (2013-04-21) @@ -9992,27 +5313,8 @@

                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                              • Bug fix: Correct requirement for socket-client
                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                              - - - SocketClient 0.3.1 - - - (2013-04-20) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                              • Feature: [SocketClient] Support connecting to IPv6 addresses (@clue)
                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                              • Bug fix: Correct requirement for socket-client

                                                                                                                                                                                                                                                                                                                                                              @@ -10030,27 +5332,8 @@

                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                              • Feature: Support binding to IPv6 addresses (@clue)
                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                              - - - SocketClient 0.3.0 - - - (2013-04-14) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                              • Feature: [SocketClient] New SocketClient component extracted from HttpClient (@clue)
                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                              • Feature: Support binding to IPv6 addresses (@clue)

                                                                                                                                                                                                                                                                                                                                                              @@ -10058,7 +5341,7 @@

                                                                                                                                                                                                                                                                                                                                                              - HttpClient 0.3.0 + HTTPClient 0.3.0 (2013-04-14) @@ -10068,7 +5351,7 @@

                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                • BC break: Socket connection handling moved to new SocketClient component
                                                                                                                                                                                                                                                                                                                                                                • Bump React dependencies to v0.3
                                                                                                                                                                                                                                                                                                                                                                @@ -10088,7 +5371,7 @@

                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                  • Feature: [Stream] Factory method for BufferedSink
                                                                                                                                                                                                                                                                                                                                                                  @@ -10107,10 +5390,10 @@

                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                    • Trigger PHP errors when invalid callback is passed.
                                                                                                                                                                                                                                                                                                                                                                    • Fully resolve rejection value before calling rejection handler.
                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                    • Add When::lazy() to create lazy promises which will be initialized once a consumer calls the then() method.
                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                    • Add When::lazy() to create lazy promises which will be initialized once a consumer calls the then() method.

                                                                                                                                                                                                                                                                                                                                                                    @@ -10128,30 +5411,8 @@

                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                      • Bump React dependencies to v0.3
                                                                                                                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                                                                                                                      - -
                                                                                                                                                                                                                                                                                                                                                                      - -

                                                                                                                                                                                                                                                                                                                                                                      - - - Async 1.0.0 - - - (2013-02-06) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                      - -
                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                      Imported release from original tag date 2013-02-06.

                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                      • First tagged release

                                                                                                                                                                                                                                                                                                                                                                      @@ -10169,7 +5430,7 @@

                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                        • Bump React dependencies to v0.3
                                                                                                                                                                                                                                                                                                                                                                        @@ -10188,7 +5449,7 @@

                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                          • Bump React dependencies to v0.3
                                                                                                                                                                                                                                                                                                                                                                          @@ -10207,7 +5468,7 @@

                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                            • Version bump
                                                                                                                                                                                                                                                                                                                                                                            @@ -10226,9 +5487,9 @@

                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                            • BC break: New timers API (@nrk)
                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                            • BC break: Remove check on return value from stream callbacks (@nrk)
                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                              • BC break: New timers API (@nrk)
                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                              • BC break: Remove check on return value from stream callbacks (@nrk)

                                                                                                                                                                                                                                                                                                                                                                              @@ -10246,9 +5507,9 @@

                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: Fix libevent timers with PHP 5.3
                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: Fix libevent timer cancellation (@nrk)
                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: Fix libevent timer cancellation (@nrk)

                                                                                                                                                                                                                                                                                                                                                                                @@ -10261,7 +5522,7 @@

                                                                                                                                                                                                                                                                                                                                                                                - HttpClient 0.2.6 + HTTPClient 0.2.6 (2012-12-26) @@ -10271,7 +5532,7 @@

                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                  • Version bump
                                                                                                                                                                                                                                                                                                                                                                                  @@ -10290,7 +5551,7 @@

                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                    • Feature: New cache component, used by DNS
                                                                                                                                                                                                                                                                                                                                                                                    @@ -10309,8 +5570,8 @@

                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                    • Bug fix: Plug memory issue in libevent timers (@cameronjacobson)
                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: Plug memory issue in libevent timers (@cameronjacobson)
                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: Correctly pause LibEvLoop on stop()
                                                                                                                                                                                                                                                                                                                                                                                      @@ -10329,8 +5590,8 @@

                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: Emit end event when Response closes (@beaucollins)
                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Emit end event when Response closes (@beaucollins)

                                                                                                                                                                                                                                                                                                                                                                                        @@ -10348,7 +5609,7 @@

                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                          • Feature: New cache component, used by DNS
                                                                                                                                                                                                                                                                                                                                                                                          @@ -10367,7 +5628,7 @@

                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                            • Version bump
                                                                                                                                                                                                                                                                                                                                                                                            @@ -10386,7 +5647,7 @@

                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                              • Version bump
                                                                                                                                                                                                                                                                                                                                                                                              @@ -10395,7 +5656,7 @@

                                                                                                                                                                                                                                                                                                                                                                                              - HttpClient 0.2.5 + HTTPClient 0.2.5 (2012-11-26) @@ -10405,7 +5666,7 @@

                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Use a promise-based API internally
                                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: Use DNS resolver correctly
                                                                                                                                                                                                                                                                                                                                                                                                @@ -10425,7 +5686,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                  • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                  @@ -10444,8 +5705,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: Make BufferedSink trigger progress events on the promise (@jsor)
                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: Make BufferedSink trigger progress events on the promise (@jsor)

                                                                                                                                                                                                                                                                                                                                                                                                    @@ -10463,7 +5724,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                      • Feature: Added ThroughStream, CompositeStream, ReadableStream and WritableStream
                                                                                                                                                                                                                                                                                                                                                                                                      • Feature: Added BufferedSink
                                                                                                                                                                                                                                                                                                                                                                                                      @@ -10483,8 +5744,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                      • Add PromisorInterface for objects that have a promise() method.
                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                        • Add PromisorInterface for objects that have a promise() method.

                                                                                                                                                                                                                                                                                                                                                                                                        @@ -10502,8 +5763,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                        • Feature: Change to promise-based API (@jsor)
                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                          • Feature: Change to promise-based API (@jsor)

                                                                                                                                                                                                                                                                                                                                                                                                          @@ -10521,9 +5782,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                          • Fix bug in When::any() not correctly unwrapping to a single result value
                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                          • $promiseOrValue argument of When::resolve() and When::reject() is now optional
                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                            • Fix bug in When::any() not correctly unwrapping to a single result value
                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                            • $promiseOrValue argument of When::resolve() and When::reject() is now optional

                                                                                                                                                                                                                                                                                                                                                                                                            @@ -10541,7 +5802,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                              • Prevent deep recursion which was reaching xdebug.max_nesting_level default of 100
                                                                                                                                                                                                                                                                                                                                                                                                              @@ -10560,8 +5821,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: LibEvLoop, integration of php-libev
                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: LibEvLoop, integration of php-libev

                                                                                                                                                                                                                                                                                                                                                                                                                @@ -10579,9 +5840,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: Forward drain events from HTTP response (@cs278)
                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                • Dependency: Updated guzzle deps to 3.0.*
                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                  • Bug fix: Forward drain events from HTTP response (@cs278)
                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                  • Dependency: Updated guzzle deps to 3.0.*

                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -10599,7 +5860,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                    • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -10618,7 +5879,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -10637,7 +5898,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                        • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -10646,7 +5907,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                        - HttpClient 0.2.3 + HTTPClient 0.2.3 (2012-11-05) @@ -10656,7 +5917,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                          • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -10665,7 +5926,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          - HttpClient 0.2.2 + HTTPClient 0.2.2 (2012-10-28) @@ -10675,8 +5936,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • Feature: HTTP client (@arnaud-lb)
                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -10694,7 +5955,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                              • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -10713,7 +5974,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -10732,7 +5993,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                  • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -10751,9 +6012,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: DNS executor timeout handling (@arnaud-lb)
                                                                                                                                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: DNS retry executor (@arnaud-lb)
                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -10771,8 +6032,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                    • Bug fix: Check for EOF in Buffer::write()
                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: Check for EOF in Buffer::write()

                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -10790,7 +6051,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                        • Feature: Support HTTP 1.1 continue
                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -10809,7 +6070,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                          • Minor adjustments to DNS parser
                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -10828,7 +6089,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                            • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -10847,7 +6108,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: DNS resolver
                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -10866,7 +6127,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bump React dependencies to v0.2
                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -10885,7 +6146,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Bump React dependencies to v0.2
                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -10904,7 +6165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -10923,7 +6184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: Testing and functional against PHP >= 5.3.3 and <= 5.3.8
                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -10942,7 +6203,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -10961,7 +6222,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -10980,7 +6241,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -10999,7 +6260,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -11018,7 +6279,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -11037,7 +6298,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -11056,7 +6317,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -11079,7 +6340,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    diff --git a/child-process/changelog.html b/child-process/changelog.html index 185e412c4..0014bcb62 100644 --- a/child-process/changelog.html +++ b/child-process/changelog.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -41,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • @@ -221,10 +203,6 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ChildProcess Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - 2025 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - - 0.6.7 - - - (2025-12-23) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Just in time for the holidays, we are happy to announce the release of v0.6.7! 🎄🎉

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This is a compatibility release that contains backported features from the 0.7.x branch.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -Once v0.7 is released, it will be the way forward for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - - 0.6.6 - - - (2025-01-01) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This is a compatibility release that contains backported features from the 0.7.x branch.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -Once v0.7 is released, it will be the way forward for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Improve PHP 8.4+ support by avoiding implicitly nullable types.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#114 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite to run tests on latest PHP versions and report failed assertions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#113 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - 2022 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - - 0.6.5 - - - (2022-09-16) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - 2021 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - - 0.6.4 - - - (2021-10-12) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / Fix: Skip sigchild check if phpinfo() has been disabled.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#89 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Fix: Fix detecting closed socket pipes on PHP 8.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#90 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - - 0.6.3 - - - (2021-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Simplify usage by supporting new default loop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#87 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      // old (still supported)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$process = new React\ChildProcess\Process($command);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$process->start($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -// new (using default loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$process = new React\ChildProcess\Process($command);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - - 0.6.2 - - - (2021-02-05) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Support PHP 8 and add non-blocking I/O support on Windows with PHP 8.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#85 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#78 by @WyriHaximus and #80 by @gdejong)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite and add .gitattributes to exclude dev files from exports.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -Run tests on PHPUnit 9, switch to GitHub actions and clean up test suite.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#75 by @reedy, #81 by @gdejong, #82 by @SimonFrings and #84 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - 2019 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - - 0.6.1 - - - (2019-02-15) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature / Fix: Improve error reporting when spawning child process fails.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#73 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - - - 0.6.0 - - - (2019-01-14) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    A major feature release with some minor API improvements!
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -This project now has limited Windows support and supports passing custom pipes
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -and file descriptors to the child process.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This update involves a few minor BC breaks. We've tried hard to avoid BC breaks
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -where possible and minimize impact otherwise. We expect that most consumers of
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -this package will actually not be affected by any BC breaks, see below for more
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / BC break: Support passing custom pipes and file descriptors to child process,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -expose all standard I/O pipes in an array and remove unused Windows-only options.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#62, #64 and #65 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      BC note: The optional $options parameter in the Process constructor
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -has been removed and a new $fds parameter has been added instead. The
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -previous $options parameter was Windows-only, available options were not
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -documented or referenced anywhere else in this library, so its actual
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -impact is expected to be relatively small. See the documentation and the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -following changelog entry if you're looking for Windows support.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Support spawning child process on Windows without process I/O pipes.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#67 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / BC break: Improve sigchild compatibility and support explicit configuration.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#63 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      // advanced: not recommended by default
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -Process::setSigchildEnabled(true);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      BC note: The old public sigchild methods have been removed, but its
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -practical impact is believed to be relatively small due to the automatic detection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve performance by prefixing all global functions calls with \ to skip
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -the look up and resolve process and go straight to the global function.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#68 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Minor documentation improvements and docblock updates.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#59 by @iamluc and #69 by @CharlotteDunois)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite to test against PHP7.2 and PHP 7.3, improve HHVM compatibility,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -add forward compatibility with PHPUnit 7 and run tests on Windows via Travis CI.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#66 and #71 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    2018

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -528,18 +228,18 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Detect "exit" immediately if last process pipe is closed
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#58 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        This introduces a simple check to see if the program is already known to be
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Detect "exit" immediately if last process pipe is closed
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#58 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        This introduces a simple check to see if the program is already known to be
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        closed when the last process pipe is closed instead of relying on a periodic
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        timer. This simple change improves "exit" detection significantly for most
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        programs and does not cause a noticeable penalty for more advanced use cases.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Fix forward compatibility with upcoming EventLoop releases
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#56 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Fix forward compatibility with upcoming EventLoop releases
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#56 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -563,16 +263,16 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Fix: Update Stream dependency to work around SEGFAULT in legacy PHP < 5.4.28
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Fix: Update Stream dependency to work around SEGFAULT in legacy PHP < 5.4.28
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          and PHP < 5.5.12
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#50 and #52 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#50 and #52 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          adding forward compatibility with PHPUnit 6
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#53, #54 and #55 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#53, #54 and #55 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -591,15 +291,15 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Forward compatibility: react/event-loop 1.0 and 0.5, react/stream 0.7.2 and 1.0, and Événement 3.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#38 and #44 by @WyriHaximus, and #46 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +(#38 and #44 by @WyriHaximus, and #46 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Windows compatibility: Documentate that windows isn't supported in 0.5 unless used from within WSL
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#41 and #47 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +(#41 and #47 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Documentation: Termination examples
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#42 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC: Throw LogicException in Process instanciating when on Windows or when proc_open is missing (was RuntimeException)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#49 by @mdrost)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +(#42 by @clue) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC: Throw LogicException in Process instanciating when on Windows or when proc_open is missing (was RuntimeException)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#49 by @mdrost)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -617,14 +317,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Ease getting started by improving documentation and adding examples
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#33 and #34 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Ease getting started by improving documentation and adding examples
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#33 and #34 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              First class support for PHP 5.3 through PHP 7.1 and HHVM
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#29 by @clue and #32 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              First class support for PHP 5.3 through PHP 7.1 and HHVM
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#29 by @clue and #32 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -643,14 +343,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Forward compatibility with Stream v0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#26 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Forward compatibility with Stream v0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#26 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite by removing AppVeyor and adding PHPUnit to require-dev
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#27 and #28 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite by removing AppVeyor and adding PHPUnit to require-dev
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#27 and #28 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -674,11 +374,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Standalone component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Test against PHP 7 and HHVM, report test coverage, AppVeyor tests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Fix: Wait for stdout and stderr to close before watching for process exit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#18 by @mbonneau)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +(#18 by @mbonneau)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -701,7 +401,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Backwards compatibility release for Reach 0.3.x and PHP 5.3 (see #4).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Backwards compatibility release for Reach 0.3.x and PHP 5.3 (see #4).


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -718,8 +418,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Added ChildProcess to run async child processes within the event loop (@jmikola)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: Added ChildProcess to run async child processes within the event loop (@jmikola)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -739,8 +439,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ChildProcess
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  diff --git a/child-process/index.html b/child-process/index.html index 3d8730510..18b6520f8 100644 --- a/child-process/index.html +++ b/child-process/index.html @@ -5,7 +5,8 @@ - ChildProcess - ReactPHP + ChildProcess: +Child Process - ReactPHP @@ -20,13 +21,13 @@ - - + + - - - + + + @@ -40,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  - @@ -248,110 +229,78 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ChildProcess

                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Tests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • License
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Quickstart example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new React\ChildProcess\Process('echo foo');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->stdout->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->on('exit', function($exitCode, $termSignal) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Process exited with code ' . $exitCode . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Process

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Stream Properties

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Quickstart example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process = new React\ChildProcess\Process('echo foo');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->start($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->stdout->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->on('exit', function($exitCode, $termSignal) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'Process exited with code ' . $exitCode . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Process

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Stream Properties

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Once a process is started, its I/O streams will be constructed as instances of React\Stream\ReadableStreamInterface and React\Stream\WritableStreamInterface. -Before start() is called, these properties are not set. Once a process terminates, +Before start() is called, these properties are null.Once a process terminates, the streams will become closed but not unset.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Following common Unix conventions, this library will start each child process -with the three pipes matching the standard I/O streams as given below by default. -You can use the named references for common use cases or access these as an -array with all three pipes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -$stdin or $pipes[0] is a WritableStreamInterface -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -$stdout or $pipes[1] is a ReadableStreamInterface -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -$stderr or $pipes[2] is a ReadableStreamInterface -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • $stdin
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • $stdout
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • $stderr
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that this default configuration may be overridden by explicitly passing -custom pipes, in which case they may not be set or be assigned -different values. In particular, note that Windows support -is limited in that it doesn't support non-blocking STDIO pipes. The $pipes -array will always contain references to all pipes as configured and the standard -I/O references will always be set to reference the pipes matching the above -conventions. See custom pipes for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Because each of these implement the underlying +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Each of these implement the underlying ReadableStreamInterface or -WritableStreamInterface, +WritableStreamInterface and you can use any of their events and methods as usual:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process($command);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->stdout->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->stdout->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'ended';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->stdout->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'error: ' . $e->getMessage();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->stdout->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'closed';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->stdin->write($data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->stdin->end($data = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// …
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process->stdout->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->stdout->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'ended';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->stdout->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'error: ' . $e->getMessage();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->stdout->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'closed';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->stdin->write($data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->stdin->end($data = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +//

                                                                                                                                                                                                                                                                                                                                                                                                                                                                For more details, see the ReadableStreamInterface and WritableStreamInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Command

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Command

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The Process class allows you to pass any kind of command line string:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('echo test');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The command line string usually consists of a whitespace-separated list with -your main executable bin and any number of arguments. Special care should be -taken to escape or quote any arguments, escpecially if you pass any user input -along. Likewise, keep in mind that especially on Windows, it is rather common to -have path names containing spaces and other special characters. If you want to -run a binary like this, you will have to ensure this is quoted as a single -argument using escapeshellarg() like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $bin = 'C:\\Program files (x86)\\PHP\\php.exe';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$file = 'C:\\Users\\me\\Desktop\\Application\\main.php';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process = new Process(escapeshellarg($bin) . ' ' . escapeshellarg($file));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('echo test');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->start($loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, PHP will launch processes by wrapping the given command line string -in a sh command on Unix, so that the first example will actually execute -sh -c echo test under the hood on Unix. On Windows, it will not launch -processes by wrapping them in a shell.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +in a sh command, so that the above example will actually execute +sh -c echo test under the hood.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is a very useful feature because it does not only allow you to pass single commands, but actually allows you to pass any kind of shell command line and launch multiple sub-commands using command chains (with &&, ||, ; and others) and allows you to redirect STDIO streams (with 2>&1 and family). This can be used to pass complete command lines and receive the resulting STDIO streams from the wrapping shell command like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('echo run && demo || echo failed');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that Windows support is limited in that it -doesn't support STDIO streams at all and also that processes will not be run -in a wrapping shell by default. If you want to run a shell built-in function -such as echo hello or sleep 10, you may have to prefix your command line -with an explicit shell like cmd /c echo hello.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('echo run && demo || echo failed');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->start($loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In other words, the underlying shell is responsible for managing this command line and launching the individual sub-commands and connecting their STDIO streams as appropriate. @@ -361,24 +310,24 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to discern the output of single sub-commands, you may want to implement some higher-level protocol logic, such as printing an explicit boundary between each sub-command like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('cat first && echo --- && cat second');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('cat first && echo --- && cat second');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->start($loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                As an alternative, considering launching one process at a time and listening on its exit event to conditionally start the next process in the chain. This will give you an opportunity to configure the subsequent process I/O streams:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $first = new Process('cat first');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$first->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$first->on('exit', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $second = new Process('cat second');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $second->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Keep in mind that PHP uses the shell wrapper for ALL command lines on Unix. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                $first = new Process('cat first');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$first->start($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$first->on('exit', function () use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $second = new Process('cat second');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $second->start($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Keep in mind that PHP uses the shell wrapper for ALL command lines. While this may seem reasonable for more complex command lines, this actually also applies to running the most simple single command:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('yes');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This will actually spawn a command hierarchy similar to this on Unix:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('yes');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->start($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This will actually spawn a command hierarchy similar to this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                5480 … \_ php example.php
                                                                                                                                                                                                                                                                                                                                                                                                                                                                 5481 …    \_ sh -c yes
                                                                                                                                                                                                                                                                                                                                                                                                                                                                 5482 …        \_ yes
                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -387,10 +336,10 @@ 

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess

                                                                                                                                                                                                                                                                                                                                                                                                                                                                will actually target the wrapping shell, which may not be the desired result in many cases.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you do not want this wrapping shell process to show up, you can simply -prepend the command string with exec on Unix platforms, which will cause the -wrapping shell process to be replaced by our process:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('exec yes');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +prepend the command string with exec, which will cause the wrapping shell +process to be replaced by our process:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('exec yes');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->start($loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This will show a resulting command hierarchy similar to this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                5480 … \_ php example.php
                                                                                                                                                                                                                                                                                                                                                                                                                                                                 5481 …    \_ yes
                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -404,22 +353,23 @@ 

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess

                                                                                                                                                                                                                                                                                                                                                                                                                                                                shell. If you pass a complete command line (or are unsure), you SHOULD most likely keep the wrapping shell. -If you're running on Unix and you want to pass an invidual command only, you MAY -want to consider prepending the command string with exec to avoid the wrapping shell.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Termination

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +If you want to pass an invidual command only, you MAY want to consider +prepending the command string with exec to avoid the wrapping shell.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Termination

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The exit event will be emitted whenever the process is no longer running. Event listeners will receive the exit code and termination signal as two arguments:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('sleep 10');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->on('exit', function ($code, $term) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    if ($term === null) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'exit with code ' . $code . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'terminated with signal ' . $term . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('sleep 10');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->start($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->on('exit', function ($code, $term) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    if ($term === null) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        echo 'exit with code ' . $code . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        echo 'terminated with signal ' . $term . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that $code is null if the process has terminated, but the exit code could not be determined (for example sigchild compatibility was disabled). @@ -440,7 +390,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Depending on which signal you send to the process and whether it has a signal handler registered, this can be used to either merely signal a process or even forcefully terminate it.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process->terminate(SIGUSR1);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process->terminate(SIGUSR1);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Keep the above section in mind if you want to forcefully terminate a process. If your process spawn sub-processes or implicitly uses the wrapping shell mentioned above, its file descriptors may be @@ -448,256 +398,77 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess

                                                                                                                                                                                                                                                                                                                                                                                                                                                                necessarily terminate the whole process tree. It is highly suggested that you explicitly close() all process pipes accordingly when terminating a process:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('sleep 10');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(2.0, function () use ($process) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    foreach ($process->pipes as $pipe) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        $pipe->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $process->terminate();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('sleep 10');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->start($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->addTimer(2.0, function () use ($process) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $process->stdin->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $process->stout->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $process->stderr->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $process->terminate(SIGKILL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                                For many simple programs these seamingly complicated steps can also be avoided by prefixing the command line with exec to avoid the wrapping shell and its inherited process pipes as mentioned above.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('exec sleep 10');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(2.0, function () use ($process) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $process->terminate();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('exec sleep 10');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->start($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->addTimer(2.0, function () use ($process) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $process->terminate();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Many command line programs also wait for data on STDIN and terminate cleanly when this pipe is closed. For example, the following can be used to "soft-close" a cat process:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('cat');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(2.0, function () use ($process) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $process->stdin->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('cat');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$process->start($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->addTimer(2.0, function () use ($process) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $process->stdin->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                                While process pipes and termination may seem confusing to newcomers, the above properties actually allow some fine grained control over process termination, such as first trying a soft-close and then applying a force-close after a timeout.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Custom pipes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Following common Unix conventions, this library will start each child process -with the three pipes matching the standard I/O streams by default. For more -advanced use cases it may be useful to pass in custom pipes, such as explicitly -passing additional file descriptors (FDs) or overriding default process pipes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that passing custom pipes is considered advanced usage and requires a -more in-depth understanding of Unix file descriptors and how they are inherited -to child processes and shared in multi-processing applications.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you do not want to use the default standard I/O pipes, you can explicitly -pass an array containing the file descriptor specification to the constructor -like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $fds = array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // standard I/O pipes for stdin/stdout/stderr
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    0 => array('pipe', 'r'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    1 => array('pipe', 'w'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    2 => array('pipe', 'w'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // example FDs for files or open resources
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    4 => array('file', '/dev/null', 'r'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    6 => fopen('log.txt','a'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    8 => STDERR,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // example FDs for sockets
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    10 => fsockopen('localhost', 8080),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    12 => stream_socket_server('tcp://0.0.0.0:4711')
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process = new Process($cmd, null, null, $fds);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Unless your use case has special requirements that demand otherwise, you're -highly recommended to (at least) pass in the standard I/O pipes as given above. -The file descriptor specification accepts arguments in the exact same format -as the underlying proc_open() function.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Once the process is started, the $pipes array will always contain references to -all pipes as configured and the standard I/O references will always be set to -reference the pipes matching common Unix conventions. This library supports any -number of pipes and additional file descriptors, but many common applications -being run as a child process will expect that the parent process properly -assigns these file descriptors.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Sigchild Compatibility

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internally, this project uses a work-around to improve compatibility when PHP -has been compiled with the --enable-sigchild option. This should not affect most -installations as this configure option is not used by default and many -distributions (such as Debian and Ubuntu) are known to not use this by default. -Some installations that use Oracle OCI8 -may use this configure option to circumvent defunct processes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                When PHP has been compiled with the --enable-sigchild option, a child process' -exit code cannot be reliably determined via proc_close() or proc_get_status(). -To work around this, we execute the child process with an additional pipe and -use that to retrieve its exit code.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This work-around incurs some overhead, so we only trigger this when necessary -and when we detect that PHP has been compiled with the --enable-sigchild option. -Because PHP does not provide a way to reliably detect this option, we try to -inspect output of PHP's configure options from the phpinfo() function.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The static setSigchildEnabled(bool $sigchild): void method can be used to -explicitly enable or disable this behavior like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // advanced: not recommended by default
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Process::setSigchildEnabled(true);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that all processes instantiated after this method call will be affected. -If this work-around is disabled on an affected PHP installation, the exit -event may receive null instead of the actual exit code as described above. -Similarly, some distributions are known to omit the configure options from -phpinfo(), so automatic detection may fail to enable this work-around in some -cases. You may then enable this explicitly as given above.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note: The original functionality was taken from Symfony's +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Sigchild Compatibility

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                When PHP has been compiled with the --enabled-sigchild option, a child +process' exit code cannot be reliably determined via proc_close() or +proc_get_status(). Instead, we execute the child process with a fourth pipe +and use that to retrieve its exit code.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This behavior is used by default and only when necessary. It may be manually +disabled by calling setEnhanceSigchildCompatibility(false) on the Process +before it is started, in which case the exit event may receive null instead +of the actual exit code.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note: This functionality was taken from Symfony's Process compoment.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Windows Compatibility

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Due to platform constraints, this library provides only limited support for -spawning child processes on Windows. In particular, PHP does not allow accessing -standard I/O pipes on Windows without blocking. As such, this project will not -allow constructing a child process with the default process pipes and will -instead throw a LogicException on Windows by default:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // throws LogicException on Windows
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process = new Process('ping example.com');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                There are a number of alternatives and workarounds as detailed below if you want -to run a child process on Windows, each with its own set of pros and cons:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  As of PHP 8, you can start the child process with socket pair descriptors -in place of normal standard I/O pipes like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $process = new Process(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    'ping example.com',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    null,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    null,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        ['socket'],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        ['socket'],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        ['socket']
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    ]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process->stdout->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  These socket pairs support non-blocking process I/O on any platform, -including Windows. However, not all programs accept stdio sockets.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  This package does work on -Windows Subsystem for Linux -(or WSL) without issues. When you are in control over how your application is -deployed, we recommend installing WSL +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Windows Compatibility

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Due to the blocking nature of STDIN/STDOUT/STDERR pipes on Windows we can +not guarantee this package works as expected on Windows directly. As such when +instantiating Process it throws an exception when on native Windows. +However this package does work on Windows Subsystem for Linux +(or WSL) without issues. We suggest installing WSL when you want to run this package on Windows.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  If you only care about the exit code of a child process to check if its -execution was successful, you can use custom pipes to omit -any standard I/O pipes like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $process = new Process('ping example.com', null, null, array());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process->on('exit', function ($exitcode) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'exit with ' . $exitcode . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Similarly, this is also useful if your child process communicates over -sockets with remote servers or even your parent process using the -Socket component. This is usually -considered the best alternative if you have control over how your child -process communicates with the parent process.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  If you only care about command output after the child process has been -executed, you can use custom pipes to configure file -handles to be passed to the child process instead of pipes like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $process = new Process('ping example.com', null, null, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    array('file', 'nul', 'r'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $stdout = tmpfile(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    array('file', 'nul', 'w')
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process->on('exit', function ($exitcode) use ($stdout) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'exit with ' . $exitcode . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    // rewind to start and then read full file (demo only, this is blocking).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    // reading from shared file is only safe if you have some synchronization in place
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    // or after the child process has terminated.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    rewind($stdout);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo stream_get_contents($stdout);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    fclose($stdout);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Note that this example uses tmpfile()/fopen() for illustration purposes only. -This should not be used in a truly async program because the filesystem is -inherently blocking and each call could potentially take several seconds. -See also the Filesystem component as an -alternative.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  If you want to access command output as it happens in a streaming fashion, -you can use redirection to spawn an additional process to forward your -standard I/O streams to a socket and use custom pipes to -omit any actual standard I/O pipes like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $server = new React\Socket\Server('127.0.0.1:0');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$server->on('connection', function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $connection->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$command = 'ping example.com | foobar ' . escapeshellarg($server->getAddress());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process = new Process($command, null, null, array());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process->on('exit', function ($exitcode) use ($server) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $server->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'exit with ' . $exitcode . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Note how this will spawn another fictional foobar helper program to consume -the standard output from the actual child process. This is in fact similar -to the above recommendation of using socket connections in the child process, -but in this case does not require modification of the actual child process.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  In this example, the fictional foobar helper program can be implemented by -simply consuming all data from standard input and forwarding it to a socket -connection like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $socket = stream_socket_client($argv[1]);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -do {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    fwrite($socket, $data = fread(STDIN, 8192));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -} while (isset($data[0]));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Accordingly, this example can also be run with plain PHP without having to -rely on any external helper program like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $code = '$s=stream_socket_client($argv[1]);do{fwrite($s,$d=fread(STDIN, 8192));}while(isset($d[0]));';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$command = 'ping example.com | php -r ' . escapeshellarg($code) . ' ' . escapeshellarg($server->getAddress());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process = new Process($command, null, null, array());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  See also example #23.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Note that this is for illustration purposes only and you may want to implement -some proper error checks and/or socket verification in actual production use -if you do not want to risk other processes connecting to the server socket. -In this case, we suggest looking at the excellent -createprocess-windows.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Additionally, note that the command given to the Process will be -passed to the underlying Windows-API -(CreateProcess) -as-is and the process will not be launched in a wrapping shell by default. In -particular, this means that shell built-in functions such as echo hello or -sleep 10 may have to be prefixed with an explicit shell command like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $process = new Process('cmd /c echo hello', null, null, $pipes);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$process->start();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                composer require react/child-process:^0.6.7
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer require react/child-process:^0.5.2

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.3 through current PHP 8+ and HHVM. -It's highly recommended to use the latest supported PHP version for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. +It's highly recommended to use PHP 7+ for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See above note for limited Windows Compatibility.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ php vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -219,8 +201,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The MIT License (MIT)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2012 Christian Lück, Cees-Jan Kiewiet, Jan Sorgalla, Chris Boden, Igor Wiedler

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2012 Igor Wiedler, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -243,8 +224,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                diff --git a/datagram/changelog.html b/datagram/changelog.html index 85cbf49ea..41678022d 100644 --- a/datagram/changelog.html +++ b/datagram/changelog.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -41,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -221,10 +203,6 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Datagram Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2024 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.10.0 - - - (2024-09-06) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#59 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Full PHP 8.3 compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#57 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2022 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.9.0 - - - (2022-12-05) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2021 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.8.0 - - - (2021-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Simplify usage by supporting new default loop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#42 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old (still supported)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$factory = new React\Datagram\Factory($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new (using default loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$factory = new React\Datagram\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.7.0 - - - (2021-06-25) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support falling back to multiple DNS servers from DNS config.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#41 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  When using the Factory, it will now use all DNS servers configured on your
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -system. If you have multiple DNS servers configured and connectivity to the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -primary DNS server is broken, it will now fall back to your other DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -servers, thus providing improved connectivity and redundancy for broken DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -configurations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.6.0 - - - (2021-02-12) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support PHP 8 (socket address of closed socket should be null).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#39 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite and add .gitattributes to exclude dev files from exports.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Run tests on PHPUnit 9, switch to GitHub actions and clean up test suite.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#30, #31 and #38 by @clue, #34 by @reedy, #35 by @WyriHaximus and #37 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2019 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.5.0 - - - (2019-07-10) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Forward compatibility with upcoming stable DNS component.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#29 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Prefix all global functions calls with \ to skip the look up and resolve process and go straight to the global function.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#28 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite to also test against PHP 7.1 and 7.2.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#25 by @andreybolonin)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                2018

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -451,21 +229,21 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Update DNS dependency to support loading system default DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Update DNS dependency to support loading system default DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    nameserver config on all supported platforms
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(/etc/resolv.conf on Unix/Linux/Mac/Docker/WSL and WMIC on Windows)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#23 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This means that connecting to hosts that are managed by a local DNS server,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(/etc/resolv.conf on Unix/Linux/Mac/Docker/WSL and WMIC on Windows)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#23 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This means that connecting to hosts that are managed by a local DNS server,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    such as a corporate DNS server or when using Docker containers, will now
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    work as expected across all platforms with no changes required:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    $factory = new Factory($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -$factory->createClient('intranet.example:5353');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    $factory = new Factory($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +$factory->createClient('intranet.example:5353');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve README
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#22 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve README
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#22 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -489,16 +267,16 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Always use Resolver with default DNS to match Socket component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Always use Resolver with default DNS to match Socket component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      and update DNS dependency to support hosts file on all platforms
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#19 and #20 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      This means that connecting to hosts such as localhost (and for example
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#19 and #20 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      This means that connecting to hosts such as localhost (and for example
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      those used for Docker containers) will now work as expected across all
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      platforms with no changes required:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $factory = new Factory($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$factory->createClient('localhost:5353');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $factory = new Factory($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$factory->createClient('localhost:5353');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -517,18 +295,18 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Target evenement 3.0 a long side 2.0 and 1.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#16 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Target evenement 3.0 a long side 2.0 and 1.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#16 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Forward compatibility with EventLoop v1.0 and v0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#18 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Forward compatibility with EventLoop v1.0 and v0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#18 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Improve test suite by updating Travis build config so new defaults do not break the build
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#17 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Improve test suite by updating Travis build config so new defaults do not break the build
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#17 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -547,11 +325,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Fix: Properly format IPv6 addresses and return null for unknown addresses
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#14 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Fix: Properly format IPv6 addresses and return null for unknown addresses
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#14 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Fix: Skip IPv6 tests if not supported by the system
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#15 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +(#15 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -574,13 +352,13 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Feature: Support promise cancellation (cancellation of underlying DNS lookup)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#12 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +(#12 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Fix: Fix error reporting when trying to create invalid sockets
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#11 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +(#11 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improve test suite and update dependencies
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#7, #8 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +(#7, #8 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -603,9 +381,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Fix: Correct formatting for remote peer address of incoming datagrams when using IPv6
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#6 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +(#6 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improve test suite for different PHP versions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -629,13 +407,13 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Initial tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              This project has been migrated over from clue/datagram
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              This project has been migrated over from clue/datagram
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              which has originally been released in January 2013.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -Upgrading from clue/datagram v0.5.0? Use namespace React\Datagram instead of Datagram and you're ready to go!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Upgrading from clue/datagram v0.5.0? Use namespace React\Datagram instead of Datagram and you're ready to go!


                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -655,8 +433,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Datagram
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              diff --git a/datagram/index.html b/datagram/index.html index 67ae4c3d9..0ea368767 100644 --- a/datagram/index.html +++ b/datagram/index.html @@ -5,7 +5,8 @@ - Datagram - ReactPHP + Datagram: +Datagram - ReactPHP @@ -20,13 +21,13 @@ - - + + - - - + + + @@ -40,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -219,44 +202,51 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Datagram

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Datagram

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                CI status -installs on Packagist

                                                                                                                                                                                                                                                                                                                                                                                                                                                                + +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Build Status

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Event-driven UDP datagram socket client and server for ReactPHP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Quickstart example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Quickstart example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Once installed, you can use the following code to connect to an UDP server listening on localhost:1234 and send and receive UDP datagrams:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $factory = new React\Datagram\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$factory->createClient('localhost:1234')->then(function (React\Datagram\Socket $client) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $client->send('first');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $client->on('message', function($message, $serverAddress, $client) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'received "' . $message . '" from ' . $serverAddress. PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$factory = new React\Datagram\Factory($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$factory->createClient('localhost:1234')->then(function (React\Datagram\Socket $client) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $client->send('first');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $client->on('message', function($message, $serverAddress, $client) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        echo 'received "' . $message . '" from ' . $serverAddress. PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This library's API is modelled after node.js's API for UDP / Datagram Sockets (dgram.Socket).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This project follows SemVer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This project follows SemVer. This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                composer require react/datagram:^1.10
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer require react/datagram:^1.4

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.3 through current PHP 8+ and +extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. It's highly recommended to use PHP 7+ for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ php vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -220,7 +202,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Datagram License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The MIT License (MIT)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2013 Christian Lück, Cees-Jan Kiewiet, Jan Sorgalla, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2013 Christian Lück

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -243,8 +225,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Datagram
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                diff --git a/dns/changelog.html b/dns/changelog.html index 10b221bf7..0a2bdf58a 100644 --- a/dns/changelog.html +++ b/dns/changelog.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -41,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -221,14 +203,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2025 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.14.0 - - - (2025-11-18) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve PHP 8.5+ support by avoiding deprecated setAccessible() calls.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#238 by @W0rma and #243 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, update test environment and increase query count in excessive TCP query tests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#239 and #240 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2024 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.13.0 - - - (2024-06-13) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#224 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2023 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.12.0 - - - (2023-11-29) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.11.0 - - - (2023-06-02) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2022 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.10.0 - - - (2022-09-08) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Full support for PHP 8.2 release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#201 by @clue and #207 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Optimize forward compatibility with Promise v3, avoid hitting autoloader.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#202 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix: Improve error reporting when custom error handler is used.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#197 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix invalid references in exception stack trace.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#191 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#195 by @SimonFrings and #203 by @nhedger)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, update to use default loop and new reactphp/async package.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#204, #205 and #206 by @clue and #196 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2021 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.9.0 - - - (2021-12-20) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Full support for PHP 8.1 release and prepare PHP 8.2 compatibility
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -by refactoring Parser to avoid assigning dynamic properties.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#188 and #186 by @clue and #184 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Avoid dependency on ext-filter.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#185 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix: Skip invalid nameserver entries from resolv.conf and ignore IPv6 zone IDs.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#187 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix: Reduce socket read chunk size for queries over TCP/IP.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#189 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.8.0 - - - (2021-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Simplify usage by supporting new default loop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#182 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old (still supported)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$resolver = $factory->create($config, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new (using default loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$resolver = $factory->create($config);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.7.0 - - - (2021-06-25) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Update DNS Factory to accept complete Config object.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Add new FallbackExecutor and use fallback DNS servers when Config lists multiple servers.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#179 and #180 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old (still supported)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$config = React\Dns\Config\Config::loadSystemConfigBlocking();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$resolver = $factory->create($server, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$config = React\Dns\Config\Config::loadSystemConfigBlocking();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -if (!$config->nameservers) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $config->nameservers[] = '8.8.8.8';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$resolver = $factory->create($config, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.6.0 - - - (2021-06-21) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add support for legacy SPF record type.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#178 by @akondas and @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix integer overflow for TCP/IP chunk size on 32 bit platforms.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#177 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.5.0 - - - (2021-03-05) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve error reporting when query fails, include domain and query type and DNS server address where applicable.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#174 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve error handling when sending data to DNS server fails (macOS).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#171 and #172 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Improve DNS response parser to limit recursion for compressed labels.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#169 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, use GitHub actions for continuous integration (CI).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#170 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2020 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.4.0 - - - (2020-09-18) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.3.0 - - - (2020-07-10) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Forward compatibility with react/promise v3.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#153 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support parsing OPT records (EDNS0).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#157 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Avoid PHP warnings due to lack of args in exception trace on PHP 7.4.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#160 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite and add .gitattributes to exclude dev files from exports.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Run tests on PHPUnit 9 and PHP 7.4 and clean up test suite.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#154 by @reedy, #156 by @clue and #163 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2019 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.2.0 - - - (2019-08-15) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add TcpTransportExecutor to send DNS queries over TCP/IP connection,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -add SelectiveTransportExecutor to retry with TCP if UDP is truncated and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -automatically select transport protocol when no explicit udp:// or tcp:// scheme is given in Factory.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#145, #146, #147 and #148 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support escaping literal dots and special characters in domain names.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#144 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.1.0 - - - (2019-07-18) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support parsing CAA and SSHFP records.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#141 and #142 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add ResolverInterface as common interface for Resolver class.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#139 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Add missing private property definitions and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -remove unneeded dependency on react/stream.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#140 and #143 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.0.0 - - - (2019-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • First stable LTS release, now following SemVer.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -We'd like to emphasize that this component is production ready and battle-tested.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -We plan to support all long-term support (LTS) releases for at least 24 months,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -so you have a rock-solid foundation to build on top of.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This update involves a number of BC breaks due to dropped support for
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -deprecated functionality and some internal API cleanup. We've tried hard to
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -avoid BC breaks where possible and minimize impact otherwise. We expect that
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -most consumers of this package will actually not be affected by any BC
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -breaks, see below for more details:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC break: Delete all deprecated APIs, use Query objects for Message questions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -instead of nested arrays and increase code coverage to 100%.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#130 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC break: Move $nameserver from ExecutorInterface to UdpTransportExecutor,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -remove advanced/internal UdpTransportExecutor args for Parser/BinaryDumper and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -add API documentation for ExecutorInterface.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#135, #137 and #138 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC break: Replace HeaderBag attributes with simple Message properties.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#132 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC break: Mark all Record attributes as required, add documentation vs Query.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#136 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC break: Mark all classes as final to discourage inheritance
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#134 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.4.19 - - - (2019-07-10) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Avoid garbage references when DNS resolution rejects on legacy PHP <= 5.6.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#133 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.4.18 - - - (2019-07-09) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix: Implement CachingExecutor using cache TTL, deprecate old CachedExecutor,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -respect TTL from response records when caching and do not cache truncated responses.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#129 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Limit cache size to 256 last responses by default.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#127 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Cooperatively resolve hosts to avoid running same query concurrently.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#125 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.4.17 - - - (2019-04-01) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support parsing authority and additional records from DNS response.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#123 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support dumping records as part of outgoing binary DNS message.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#124 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Forward compatibility with upcoming Cache v0.6 and Cache v1.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#121 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite to add forward compatibility with PHPUnit 7,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -test against PHP 7.3 and use legacy PHPUnit 5 on legacy HHVM.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#122 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                2018

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.4.16 - - - (2018-11-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve promise cancellation for DNS lookup retries and clean up any garbage references.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#118 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Reject parsing malformed DNS response messages such as incomplete DNS response messages,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -malformed record data or malformed compressed domain name labels.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#115 and #117 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix interpretation of TTL as UINT32 with most significant bit unset.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#116 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix caching advanced MX/SRV/TXT/SOA structures.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#112 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -882,29 +230,29 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Add resolveAll() method to support custom query types in Resolver.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#110 by @clue and @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    $resolver->resolveAll('reactphp.org', Message::TYPE_AAAA)->then(function ($ips) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    echo 'IPv6 addresses for reactphp.org ' . implode(', ', $ips) . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Add resolveAll() method to support custom query types in Resolver.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#110 by @clue and @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    $resolver->resolveAll('reactphp.org', Message::TYPE_AAAA)->then(function ($ips) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    echo 'IPv6 addresses for reactphp.org ' . implode(', ', $ips) . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Support parsing NS, TXT, MX, SOA and SRV records.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#104, #105, #106, #107 and #108 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Support parsing NS, TXT, MX, SOA and SRV records.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#104, #105, #106, #107 and #108 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Add support for Message::TYPE_ANY and parse unknown types as binary data.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#104 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Add support for Message::TYPE_ANY parse unknown types as binary data.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#104 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Improve error messages for failed queries and improve documentation.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#109 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Improve error messages for failed queries and improve documentation.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#109 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Add reverse DNS lookup example.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#111 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Add reverse DNS lookup example.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#111 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -923,19 +271,19 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Add UdpTransportExecutor, validate incoming DNS response messages
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -to avoid cache poisoning attacks and deprecate legacy Executor.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#101 and #103 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Add UdpTransportExecutor, validate incoming DNS response messages
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +to avoid cache poisoning attacks and deprecate legacy Executor.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#101 and #103 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Forward compatibility with Cache 0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#102 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Forward compatibility with Cache 0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#102 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Deprecate legacy Query::$currentTime and binary parser data attributes to clean up and simplify API.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#99 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Deprecate legacy Query::$currentTime and binary parser data attributes to clean up and simplify API.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#99 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -954,18 +302,18 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Add Config::loadSystemConfigBlocking() to load default system config
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Add Config::loadSystemConfigBlocking() to load default system config
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        and support parsing DNS config on all supported platforms
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(/etc/resolv.conf on Unix/Linux/Mac and WMIC on Windows)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#92, #93, #94 and #95 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        $config = Config::loadSystemConfigBlocking();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(/etc/resolv.conf on Unix/Linux/Mac and WMIC on Windows)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#92, #93, #94 and #95 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        $config = Config::loadSystemConfigBlocking();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +$server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Remove unneeded cyclic dependency on react/socket
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#96 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Remove unneeded cyclic dependency on react/socket
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#96 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -984,12 +332,12 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Improve test suite by adding forward compatibility with PHPUnit 6,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          test against PHP 7.2, fix forward compatibility with upcoming EventLoop releases,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          add test group to skip integration tests relying on internet connection
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          and add minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#85 and #87 by @carusogabriel, #88 and #89 by @clue and #83 by @jsor)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +(#85 and #87 by @carusogabriel, #88 and #89 by @clue and #83 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1012,16 +360,16 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support resolving from default hosts file
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#75, #76 and #77 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This means that resolving hosts such as localhost will now work as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support resolving from default hosts file
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#75, #76 and #77 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This means that resolving hosts such as localhost will now work as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            expected across all platforms with no changes required:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            $resolver->resolve('localhost')->then(function ($ip) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    echo 'IP: ' . $ip;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The new HostsExecutor exists for advanced usage and is otherwise used
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            $resolver->resolve('localhost')->then(function ($ip) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    echo 'IP: ' . $ip;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The new HostsExecutor exists for advanced usage and is otherwise used
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            internally for this feature.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1041,29 +389,29 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Feature: Forward compatibility with EventLoop v1.0 and v0.5 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Feature: Forward compatibility with EventLoop v1.0 and v0.5 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              lock minimum dependencies and work around circular dependency for tests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#70 and #71 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#70 and #71 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Fix: Work around DNS timeout issues for Windows users
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#74 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Fix: Work around DNS timeout issues for Windows users
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#74 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Documentation and examples for advanced usage
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#66 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Documentation and examples for advanced usage
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#66 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Remove broken TCP code, do not retry with invalid TCP query
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#73 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Remove broken TCP code, do not retry with invalid TCP query
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#73 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Improve test suite by fixing HHVM build for now again and ignore future HHVM build errors and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Improve test suite by fixing HHVM build for now again and ignore future HHVM build errors and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              lock Travis distro so new defaults will not break the build and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              fix failing tests for PHP 7.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#68 by @WyriHaximus and #69 and #72 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#68 by @WyriHaximus and #69 and #72 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1082,9 +430,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: Forward compatibility with upcoming Socket v1.0 and v0.8
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#61 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +(#61 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1102,11 +450,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1124,9 +472,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: Forward compatibility with upcoming Socket v0.6 and v0.7 component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#57 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +(#57 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1144,12 +492,12 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Fix: Fix DNS timeout issues for Windows users and add forward compatibility
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      with Stream v0.5 and upcoming v0.6
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#53 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Improve test suite by adding PHPUnit to require-dev
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#54 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +(#53 by @clue) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Improve test suite by adding PHPUnit to require-dev
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#54 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1167,12 +515,12 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Fix: Ensure we ignore the case of the answer
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#51 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Feature: Add TimeoutExecutor and simplify internal APIs to allow internal
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#51 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Feature: Add TimeoutExecutor and simplify internal APIs to allow internal
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        code re-use for upcoming versions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#48 and #49 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +(#48 and #49 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1190,11 +538,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Fix: Fix handling connection and stream errors
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#45 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +(#45 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Feature: Add examples and forward compatibility with upcoming Socket v0.5 component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#46 and #47 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +(#46 and #47 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1217,19 +565,19 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Allow for cache adapter injection (#38 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            $factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$cache = new MyCustomCacheInstance();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$resolver = $factory->createCached('8.8.8.8', $loop, $cache);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Allow for cache adapter injection (#38 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            $factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$cache = new MyCustomCacheInstance();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$resolver = $factory->createCached('8.8.8.8', $loop, $cache);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support Promise cancellation (#35 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            $promise = $resolver->resolve('reactphp.org');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support Promise cancellation (#35 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            $promise = $resolver->resolve('reactphp.org');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1248,10 +596,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Repository maintenance, split off from main repo, improve test suite and documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • First class support for PHP7 and HHVM (#34 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Adjust compatibility to 5.3 (#30 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • First class support for PHP7 and HHVM (#34 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Adjust compatibility to 5.3 (#30 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1274,8 +622,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Bug fix: Fixed PSR-4 autoload path (@marcj/WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Bug fix: Fixed PSR-4 autoload path ()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1293,7 +641,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: Properly resolve CNAME aliases
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • @@ -1321,8 +669,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: Support default port for IPv6 addresses (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: Support default port for IPv6 addresses (@clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1340,7 +688,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bump React dependencies to v0.3
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1364,7 +712,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Feature: New cache component, used by DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1383,7 +731,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1402,8 +750,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Feature: Change to promise-based API (@jsor)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Feature: Change to promise-based API (@jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1421,7 +769,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1440,9 +788,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: DNS executor timeout handling (@arnaud-lb)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: DNS retry executor (@arnaud-lb)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1460,7 +808,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Minor adjustments to DNS parser
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1479,7 +827,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: DNS resolver
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1500,8 +848,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    diff --git a/dns/index.html b/dns/index.html index ff0975815..b0a471d93 100644 --- a/dns/index.html +++ b/dns/index.html @@ -5,7 +5,8 @@ - DNS - ReactPHP + DNS: +Dns - ReactPHP @@ -20,13 +21,13 @@ - - + + - - - + + + @@ -40,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -ResolverInterface +Resolver -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Basic usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Basic usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The most basic usage is to just create a resolver through the resolver factory. All you need to give it is a nameserver, then you can start resolving names, baby!

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $config = React\Dns\Config\Config::loadSystemConfigBlocking();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -if (!$config->nameservers) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $config->nameservers[] = '8.8.8.8';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dns = $factory->create($config);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dns->resolve('igor.io')->then(function ($ip) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    echo "Host: $ip\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the first example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$config = React\Dns\Config\Config::loadSystemConfigBlocking();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$dns = $factory->create($server, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$dns->resolve('igor.io')->then(function ($ip) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    echo "Host: $ip\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the first example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The Config class can be used to load the system default config. This is an operation that may access the filesystem and block. Ideally, this method should thus be executed only once before the loop starts and not repeatedly while it is @@ -286,45 +269,51 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS

                                                                                                                                                                                                                                                                                                                                                                                                                                                              and not repeatedly while it is running.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              But there's more.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Caching

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Caching

                                                                                                                                                                                                                                                                                                                                                                                                                                                              You can cache results by configuring the resolver to use a CachedExecutor:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $config = React\Dns\Config\Config::loadSystemConfigBlocking();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -if (!$config->nameservers) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $config->nameservers[] = '8.8.8.8';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dns = $factory->createCached($config);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dns->resolve('igor.io')->then(function ($ip) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    echo "Host: $ip\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -...
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dns->resolve('igor.io')->then(function ($ip) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    echo "Host: $ip\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$config = React\Dns\Config\Config::loadSystemConfigBlocking();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$server = $config->nameservers ? reset($config->nameservers) : '8.8.8.8';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$dns = $factory->createCached($server, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$dns->resolve('igor.io')->then(function ($ip) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    echo "Host: $ip\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +...
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$dns->resolve('igor.io')->then(function ($ip) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    echo "Host: $ip\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop->run();

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If the first call returns before the second, only one query will be executed. The second result will be served from an in memory cache. This is particularly useful for long running scripts where the same hostnames have to be looked up multiple times.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the third example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Custom cache adapter

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the third example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Custom cache adapter

                                                                                                                                                                                                                                                                                                                                                                                                                                                              By default, the above will use an in memory cache.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              You can also specify a custom cache implementing CacheInterface to handle the record cache instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $cache = new React\Cache\ArrayCache();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dns = $factory->createCached('8.8.8.8', null, $cache);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $cache = new React\Cache\ArrayCache();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$factory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$dns = $factory->createCached('8.8.8.8', $loop, $cache);

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the wiki for possible cache implementations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              ResolverInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              resolve()

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The resolve(string $domain): PromiseInterface<string> method can be used to +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Resolver

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +resolve()

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The resolve(string $domain): PromiseInterface<string,Exception> method can be used to resolve the given $domain name to a single IPv4 address (type A query).

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $resolver->resolve('reactphp.org')->then(function ($ip) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    echo 'IP for reactphp.org is ' . $ip . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $resolver->resolve('reactphp.org')->then(function ($ip) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    echo 'IP for reactphp.org is ' . $ip . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This is one of the main methods in this package. It sends a DNS query for the given $domain name to your DNS server and returns a single IP address on success.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -339,19 +328,20 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If the DNS communication fails and the server does not respond with a valid response message, this message will reject with an Exception.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Pending DNS queries can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $resolver->resolve('reactphp.org');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              resolveAll()

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The resolveAll(string $host, int $type): PromiseInterface<array> method can be used to +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $resolver->resolve('reactphp.org');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +resolveAll()

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The resolveAll(string $host, int $type): PromiseInterface<array,Exception> method can be used to resolve all record values for the given $domain name and query $type.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $resolver->resolveAll('reactphp.org', Message::TYPE_A)->then(function ($ips) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    echo 'IPv4 addresses for reactphp.org ' . implode(', ', $ips) . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$resolver->resolveAll('reactphp.org', Message::TYPE_AAAA)->then(function ($ips) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    echo 'IPv6 addresses for reactphp.org ' . implode(', ', $ips) . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $resolver->resolveAll('reactphp.org', Message::TYPE_A)->then(function ($ips) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    echo 'IPv4 addresses for reactphp.org ' . implode(', ', $ips) . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$resolver->resolveAll('reactphp.org', Message::TYPE_AAAA)->then(function ($ips) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    echo 'IPv6 addresses for reactphp.org ' . implode(', ', $ips) . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This is one of the main methods in this package. It sends a DNS query for the given $domain name to your DNS server and returns a list with all record values on success.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -370,57 +360,50 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If the DNS communication fails and the server does not respond with a valid response message, this message will reject with an Exception.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Pending DNS queries can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $resolver->resolveAll('reactphp.org', Message::TYPE_AAAA);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              UdpTransportExecutor

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $resolver->resolveAll('reactphp.org', Message::TYPE_AAAA);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Advanced Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +UdpTransportExecutor

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The UdpTransportExecutor can be used to send DNS queries over a UDP transport.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This is the main class that sends a DNS query to your DNS server and is used internally by the Resolver for the actual message transport.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              For more advanced usages one can utilize this class directly. The following example looks up the IPv6 address for igor.io.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new UdpTransportExecutor('8.8.8.8:53');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$executor->query(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new Query($name, Message::TYPE_AAAA, Message::CLASS_IN)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -)->then(function (Message $message) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    foreach ($message->answers as $answer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        echo 'IPv6: ' . $answer->data . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -}, 'printf');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the fourth example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $loop = Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$executor = new UdpTransportExecutor($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$executor->query(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    '8.8.8.8:53', 
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    new Query($name, Message::TYPE_AAAA, Message::CLASS_IN)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +)->then(function (Message $message) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    foreach ($message->answers as $answer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        echo 'IPv6: ' . $answer->data . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +}, 'printf');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the fourth example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that this executor does not implement a timeout, so you will very likely want to use this in combination with a TimeoutExecutor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new TimeoutExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new UdpTransportExecutor($nameserver),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    3.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new TimeoutExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    new UdpTransportExecutor($loop),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    3.0,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $loop
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +);

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Also note that this executor uses an unreliable UDP transport and that it does not implement any retry logic, so you will likely want to use this in combination with a RetryExecutor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new RetryExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new TimeoutExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        new UdpTransportExecutor($nameserver),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        3.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that this executor is entirely async and as such allows you to execute -any number of queries concurrently. You should probably limit the number of -concurrent queries in your application or you're very likely going to face -rate limitations and bans on the resolver end. For many common applications, -you may want to avoid sending the same query multiple times when the first -one is still pending, so you will likely want to use this in combination with -a CoopExecutor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new CoopExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new RetryExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        new TimeoutExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            new UdpTransportExecutor($nameserver),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            3.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new RetryExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    new TimeoutExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        new UdpTransportExecutor($loop),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        3.0,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $loop
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +);

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Internally, this class uses PHP's UDP sockets and does not take advantage of react/datagram purely for @@ -428,130 +411,47 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS

                                                                                                                                                                                                                                                                                                                                                                                                                                                              packages. Higher-level components should take advantage of the Datagram component instead of reimplementing this socket logic from scratch.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              TcpTransportExecutor

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The TcpTransportExecutor class can be used to -send DNS queries over a TCP/IP stream transport.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This is one of the main classes that send a DNS query to your DNS server.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              For more advanced usages one can utilize this class directly. -The following example looks up the IPv6 address for reactphp.org.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new TcpTransportExecutor('8.8.8.8:53');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$executor->query(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new Query($name, Message::TYPE_AAAA, Message::CLASS_IN)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -)->then(function (Message $message) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    foreach ($message->answers as $answer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        echo 'IPv6: ' . $answer->data . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -}, 'printf');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also example #92.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that this executor does not implement a timeout, so you will very likely -want to use this in combination with a TimeoutExecutor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new TimeoutExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new TcpTransportExecutor($nameserver),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    3.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Unlike the UdpTransportExecutor, this class uses a reliable TCP/IP -transport, so you do not necessarily have to implement any retry logic.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that this executor is entirely async and as such allows you to execute -queries concurrently. The first query will establish a TCP/IP socket -connection to the DNS server which will be kept open for a short period. -Additional queries will automatically reuse this existing socket connection -to the DNS server, will pipeline multiple requests over this single -connection and will keep an idle connection open for a short period. The -initial TCP/IP connection overhead may incur a slight delay if you only send -occasional queries – when sending a larger number of concurrent queries over -an existing connection, it becomes increasingly more efficient and avoids -creating many concurrent sockets like the UDP-based executor. You may still -want to limit the number of (concurrent) queries in your application or you -may be facing rate limitations and bans on the resolver end. For many common -applications, you may want to avoid sending the same query multiple times -when the first one is still pending, so you will likely want to use this in -combination with a CoopExecutor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new CoopExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new TimeoutExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        new TcpTransportExecutor($nameserver),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        3.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Internally, this class uses PHP's TCP/IP sockets and does not take advantage -of react/socket purely for -organizational reasons to avoid a cyclic dependency between the two -packages. Higher-level components should take advantage of the Socket -component instead of reimplementing this socket logic from scratch.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              SelectiveTransportExecutor

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The SelectiveTransportExecutor class can be used to -Send DNS queries over a UDP or TCP/IP stream transport.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This class will automatically choose the correct transport protocol to send -a DNS query to your DNS server. It will always try to send it over the more -efficient UDP transport first. If this query yields a size related issue -(truncated messages), it will retry over a streaming TCP/IP transport.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              For more advanced usages one can utilize this class directly. -The following example looks up the IPv6 address for reactphp.org.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new SelectiveTransportExecutor($udpExecutor, $tcpExecutor);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$executor->query(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new Query($name, Message::TYPE_AAAA, Message::CLASS_IN)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -)->then(function (Message $message) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    foreach ($message->answers as $answer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        echo 'IPv6: ' . $answer->data . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -}, 'printf');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that this executor only implements the logic to select the correct -transport for the given DNS query. Implementing the correct transport logic, -implementing timeouts and any retry logic is left up to the given executors, -see also UdpTransportExecutor and -TcpTransportExecutor for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that this executor is entirely async and as such allows you to execute -any number of queries concurrently. You should probably limit the number of -concurrent queries in your application or you're very likely going to face -rate limitations and bans on the resolver end. For many common applications, -you may want to avoid sending the same query multiple times when the first -one is still pending, so you will likely want to use this in combination with -a CoopExecutor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $executor = new CoopExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new SelectiveTransportExecutor(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $datagramExecutor,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $streamExecutor
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HostsFileExecutor

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +HostsFileExecutor

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that the above UdpTransportExecutor class always performs an actual DNS query. If you also want to take entries from your hosts file into account, you may use this code:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $hosts = \React\Dns\Config\HostsFile::loadFromPathBlocking();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$executor = new UdpTransportExecutor('8.8.8.8:53');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$executor = new HostsFileExecutor($hosts, $executor);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$executor->query(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new Query('localhost', Message::TYPE_A, Message::CLASS_IN)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The recommended way to install this library is through Composer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              $hosts = \React\Dns\Config\HostsFile::loadFromPathBlocking();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$executor = new UdpTransportExecutor($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$executor = new HostsFileExecutor($hosts, $executor);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$executor->query(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    '8.8.8.8:53', 
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    new Query('localhost', Message::TYPE_A, Message::CLASS_IN)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This project follows SemVer. -This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              composer require react/dns:^1.14
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $ composer require react/dns:^0.4.15

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.3 through current PHP 8+ and +extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. -It's highly recommended to use the latest supported PHP version for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +It's highly recommended to use PHP 7+ for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                              To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $ composer install

                                                                                                                                                                                                                                                                                                                                                                                                                                                              To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $ php vendor/bin/phpunit

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The test suite also contains a number of functional integration tests that rely on a stable internet connection. If you do not want to run these, they can simply be skipped like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              vendor/bin/phpunit --exclude-group internet
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              License

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $ php vendor/bin/phpunit --exclude-group internet
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +License

                                                                                                                                                                                                                                                                                                                                                                                                                                                              MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              References

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +References

                                                                                                                                                                                                                                                                                                                                                                                                                                                              • RFC 1034 Domain Names - Concepts and Facilities
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -565,8 +465,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                diff --git a/dns/license.html b/dns/license.html index a7e3ce0d0..8127fec78 100644 --- a/dns/license.html +++ b/dns/license.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -40,7 +40,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -219,8 +201,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The MIT License (MIT)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2012 Christian Lück, Cees-Jan Kiewiet, Jan Sorgalla, Chris Boden, Igor Wiedler

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2012 Igor Wiedler, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -243,8 +224,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                diff --git a/event-loop/changelog.html b/event-loop/changelog.html index a6d61679c..1c331526b 100644 --- a/event-loop/changelog.html +++ b/event-loop/changelog.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -41,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -221,12 +203,6 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2025 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.6.0 - - - (2025-11-17) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Improve PHP 8.5+ support by avoiding deprecated method calls.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#280 and #282 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2023 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.5.0 - - - (2023-11-13) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve performance by using spl_object_id() on PHP 7.2+.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#267 by @samsonasik)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Full PHP 8.3 compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#269 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Update tests for ext-uv on PHP 8+ and legacy PHP.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#270 by @clue and #268 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.4.0 - - - (2023-05-05) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve performance of Loop by avoiding unneeded method calls.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#266 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support checking EINTR constant from ext-pcntl without ext-sockets.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#265 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#254 by @nhedger)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, run tests on PHP 8.2 and report failed assertions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#258 by @WyriHaximus, #264 by @clue and #251, #261 and #262 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2022 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.3.0 - - - (2022-03-17) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve default StreamSelectLoop to report any warnings for invalid streams.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#245 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve performance of StreamSelectLoop when no timers are scheduled.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#246 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix periodic timer with zero interval for ExtEvLoop and legacy ExtLibevLoop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#243 by @lucasnetau)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Minor documentation improvements, update PHP version references.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#240, #248 and #250 by @SimonFrings, #241 by @dbu and #249 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite and test against PHP 8.1.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#238 by @WyriHaximus and #242 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2021 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.2.0 - - - (2021-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Introduce new concept of default loop with the new Loop class.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#226 by @WyriHaximus, #229, #231 and #232 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The Loop class exists as a convenient global accessor for the event loop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -It provides all methods that exist on the LoopInterface as static methods and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -will automatically execute the loop at the end of the program:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $timer = Loop::addPeriodicTimer(0.1, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Tick' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Loop::addTimer(1.0, function () use ($timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    Loop::cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Done' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The explicit loop instructions are still valid and may still be useful in some applications,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -especially for a transition period towards the more concise style.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -The Loop::get() method can be used to get the currently active event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$loop = React\EventLoop\Loop::get();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Minor documentation improvements and mark legacy extensions as deprecated.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#234 by @SimonFrings, #214 by @WyriHaximus and #233 and #235 by @nhedger)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, use GitHub actions for continuous integration (CI),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -update PHPUnit config and run tests on PHP 8.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#212 and #215 by @SimonFrings and #230 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2020 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.1.1 - - - (2020-01-01) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix reporting connection refused errors with ExtUvLoop on Linux and StreamSelectLoop on Windows.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#207 and #208 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix unsupported EventConfig and SEGFAULT on shutdown with ExtEventLoop on Windows.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#205 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Prevent interval overflow for timers very far in the future with ExtUvLoop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#196 by @PabloKowalczyk)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Check PCNTL functions for signal support instead of PCNTL extension with StreamSelectLoop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#195 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Add .gitattributes to exclude dev files from exports.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#201 by @reedy)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite to fix testing ExtUvLoop on Travis,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -fix Travis CI builds, do not install libuv on legacy PHP setups,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -fix failing test cases due to inaccurate timers,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -run tests on Windows via Travis CI and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -run tests on PHP 7.4 and simplify test matrix and test setup.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#197 by @WyriHaximus and #202, #203, #204 and #209 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2019 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.1.0 - - - (2019-02-07) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  New UV based event loop (ext-uv).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#112 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Use high resolution timer on PHP 7.3+.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#182 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve PCNTL signals by using async signal dispatching if available.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#179 by @CharlotteDunois)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite and test suite set up.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#174 by @WyriHaximus, #181 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix PCNTL signals edge case.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#183 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                2018

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -541,14 +230,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • First stable LTS release, now following SemVer.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    We'd like to emphasize that this component is production ready and battle-tested.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    We plan to support all long-term support (LTS) releases for at least 24 months,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    so you have a rock-solid foundation to build on top of.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Contains no other changes, so it's actually fully compatible with the v0.5.3 release.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Contains no other changes, so it's actually fully compatible with the v0.5.3 release.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -566,18 +255,18 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve performance by importing global functions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#167 by @Ocramius)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve performance by importing global functions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#167 by @Ocramius)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite by simplifying test bootstrap by using dev autoloader.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#169 by @lcobucci)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite by simplifying test bootstrap by using dev autoloader.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#169 by @lcobucci)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Minor internal changes to improved backward compatibility with PHP 5.3.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#166 by @Donatello-za)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Minor internal changes to improved backward compatibility with PHP 5.3.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#166 by @Donatello-za)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -596,14 +285,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Improve memory consumption and runtime performance for StreamSelectLoop timers.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#164 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Improve memory consumption and runtime performance for StreamSelectLoop timers.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#164 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Improve test suite by removing I/O dependency at StreamSelectLoopTest to fix Mac OS X tests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#161 by @nawarian)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Improve test suite by removing I/O dependency at StreamSelectLoopTest to fix Mac OS X tests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#161 by @nawarian)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -622,8 +311,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Feature: New ExtEvLoop (PECL ext-ev) (#148 by @kaduev13)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -641,215 +330,215 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        A major feature release with a significant documentation overhaul and long overdue API cleanup!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        This update involves a number of BC breaks due to dropped support for deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        A major feature release with a significant documentation overhaul and long overdue API cleanup!

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        This update involves a number of BC breaks due to dropped support for deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        functionality. We've tried hard to avoid BC breaks where possible and minimize
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        impact otherwise. We expect that most consumers of this package will actually
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        not be affected by any BC breaks, see below for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        We realize that the changes listed below may seem overwhelming, but we've tried
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        We realize that the changes listed below may seem overwhelming, but we've tried
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        to be very clear about any possible BC breaks. Don't worry: In fact, all ReactPHP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        components are already compatible and support both this new release as well as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        providing backwards compatibility with the last release.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature / BC break: Add support for signal handling via new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -LoopInterface::addSignal() and LoopInterface::removeSignal() methods.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#104 by @WyriHaximus and #111 and #150 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            $loop->addSignal(SIGINT, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    echo 'CTRL-C';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature / BC break: Add support for signal handling via new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +LoopInterface::addSignal() and LoopInterface::removeSignal() methods.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#104 by @WyriHaximus and #111 and #150 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            $loop->addSignal(SIGINT, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    echo 'CTRL-C';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Significant documentation updates for LoopInterface and Factory.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#100, #119, #126, #127, #159 and #160 by @clue, #113 by @WyriHaximus and #81 and #91 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Significant documentation updates for LoopInterface and Factory.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#100, #119, #126, #127, #159 and #160 by @clue, #113 by @WyriHaximus and #81 and #91 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Add examples to ease getting started
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#99, #100 and #125 by @clue, #59 by @WyriHaximus and #143 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Add examples to ease getting started
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#99, #100 and #125 by @clue, #59 by @WyriHaximus and #143 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Documentation for advanced timer concepts, such as monotonic time source vs wall-clock time
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Documentation for advanced timer concepts, such as monotonic time source vs wall-clock time
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            and high precision timers with millisecond accuracy or below.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#130 and #157 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#130 and #157 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Documentation for advanced stream concepts, such as edge-triggered event listeners
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Documentation for advanced stream concepts, such as edge-triggered event listeners
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            and stream buffers and allow throwing Exception if stream resource is not supported.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#129 and #158 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#129 and #158 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Throw BadMethodCallException on manual loop creation when required extension isn't installed.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#153 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Throw BadMethodCallException on manual loop creation when required extension isn't installed.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#153 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature / BC break: First class support for legacy PHP 5.3 through PHP 7.2 and HHVM
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -and remove all callable type hints for consistency reasons.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#141 and #151 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature / BC break: First class support for legacy PHP 5.3 through PHP 7.2 and HHVM
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +and remove all callable type hints for consistency reasons.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#141 and #151 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Documentation for timer API and clean up unneeded timer API.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#102 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Remove TimerInterface::cancel(), use LoopInterface::cancelTimer() instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (method invoked on timer instance)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$timer->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// already supported before: invoke method on loop instance
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Remove unneeded TimerInterface::setData() and TimerInterface::getData(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Documentation for timer API and clean up unneeded timer API.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#102 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Remove TimerInterface::cancel(), use LoopInterface::cancelTimer() instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (method invoked on timer instance)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$timer->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// already supported before: invoke method on loop instance
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Remove unneeded TimerInterface::setData() and TimerInterface::getData(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            use closure binding to add arbitrary data to timer instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (limited setData() and getData() only allows single variable)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$name = 'Tester';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$timer = $loop->addTimer(1.0, function ($timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    echo 'Hello ' . $timer->getData() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$timer->setData($name);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// already supported before: closure binding allows any number of variables
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$name = 'Tester';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->addTimer(1.0, function () use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    echo 'Hello ' . $name . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Remove unneeded TimerInterface::getLoop(), use closure binding instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (getLoop() called on timer instance)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->addTimer(0.1, function ($timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    $timer->getLoop()->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// already supported before: use closure binding as usual
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->addTimer(0.1, function () use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    $loop->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (limited setData() and getData() only allows single variable)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$name = 'Tester';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$timer = $loop->addTimer(1.0, function ($timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    echo 'Hello ' . $timer->getData() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$timer->setData($name);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// already supported before: closure binding allows any number of variables
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$name = 'Tester';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->addTimer(1.0, function () use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    echo 'Hello ' . $name . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Remove unneeded TimerInterface::getLoop(), use closure binding instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (getLoop() called on timer instance)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->addTimer(0.1, function ($timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    $timer->getLoop()->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// already supported before: use closure binding as usual
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->addTimer(0.1, function () use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    $loop->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove unneeded LoopInterface::isTimerActive() and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -TimerInterface::isActive() to reduce API surface.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#133 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (method on timer instance or on loop instance)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$timer->isActive();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->isTimerActive($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove unneeded LoopInterface::isTimerActive() and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +TimerInterface::isActive() to reduce API surface.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#133 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (method on timer instance or on loop instance)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$timer->isActive();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->isTimerActive($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Move TimerInterface one level up to React\EventLoop\TimerInterface.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#138 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (notice obsolete "Timer" namespace)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -assert($timer instanceof React\EventLoop\Timer\TimerInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -assert($timer instanceof React\EventLoop\TimerInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Move TimerInterface one level up to React\EventLoop\TimerInterface.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#138 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (notice obsolete "Timer" namespace)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +assert($timer instanceof React\EventLoop\Timer\TimerInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +assert($timer instanceof React\EventLoop\TimerInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove unneeded LoopInterface::nextTick() (and internal NextTickQueue),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -use LoopInterface::futureTick() instead.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#30 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (removed)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->nextTick(function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    echo 'tick';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// already supported before
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->futureTick(function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    echo 'tick';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove unneeded LoopInterface::nextTick() (and internal NextTickQueue),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +use LoopInterface::futureTick() instead.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#30 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (removed)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->nextTick(function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    echo 'tick';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// already supported before
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->futureTick(function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    echo 'tick';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove unneeded $loop argument for LoopInterface::futureTick()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove unneeded $loop argument for LoopInterface::futureTick()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            (and fix internal cyclic dependency).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#103 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old ($loop gets passed by default)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->futureTick(function ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    $loop->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// already supported before: use closure binding as usual
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->futureTick(function () use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    $loop->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#103 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old ($loop gets passed by default)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->futureTick(function ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    $loop->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// already supported before: use closure binding as usual
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->futureTick(function () use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    $loop->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove unneeded LoopInterface::tick().
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#72 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (removed)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->tick();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// suggested work around for testing purposes only
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->futureTick(function () use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    $loop->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove unneeded LoopInterface::tick().
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#72 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (removed)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->tick();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// suggested work around for testing purposes only
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->futureTick(function () use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    $loop->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Documentation for advanced stream API and clean up unneeded stream API.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#110 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Remove unneeded $loop argument for LoopInterface::addReadStream()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -and LoopInterface::addWriteStream(), use closure binding instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old ($loop gets passed by default)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->addReadStream($stream, function ($stream, $loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    $loop->removeReadStream($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// already supported before: use closure binding as usual
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->addReadStream($stream, function ($stream) use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    $loop->removeReadStream($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Documentation for advanced stream API and clean up unneeded stream API.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#110 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Remove unneeded $loop argument for LoopInterface::addReadStream()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +and LoopInterface::addWriteStream(), use closure binding instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old ($loop gets passed by default)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->addReadStream($stream, function ($stream, $loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    $loop->removeReadStream($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// already supported before: use closure binding as usual
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->addReadStream($stream, function ($stream) use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    $loop->removeReadStream($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove unneeded LoopInterface::removeStream() method,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -use LoopInterface::removeReadStream() and LoopInterface::removeWriteStream() instead.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#118 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->removeStream($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// already supported before
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->removeReadStream($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$loop->removeWriteStream($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove unneeded LoopInterface::removeStream() method,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +use LoopInterface::removeReadStream() and LoopInterface::removeWriteStream() instead.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#118 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->removeStream($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// already supported before
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->removeReadStream($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$loop->removeWriteStream($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Rename LibEventLoop to ExtLibeventLoop and LibEvLoop to ExtLibevLoop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Rename LibEventLoop to ExtLibeventLoop and LibEvLoop to ExtLibevLoop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            for consistent naming for event loop implementations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#128 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#128 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove optional EventBaseConfig argument from ExtEventLoop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -and make its FEATURE_FDS enabled by default.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#156 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove optional EventBaseConfig argument from ExtEventLoop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +and make its FEATURE_FDS enabled by default.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#156 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Mark all classes as final to discourage inheritance.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#131 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Mark all classes as final to discourage inheritance.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#131 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fix ExtEventLoop to keep track of stream resources (refcount)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#123 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fix ExtEventLoop to keep track of stream resources (refcount)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#123 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Ensure large timer interval does not overflow on 32bit systems
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#132 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Ensure large timer interval does not overflow on 32bit systems
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#132 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fix separately removing readable and writable side of stream when closing
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#139 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fix separately removing readable and writable side of stream when closing
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#139 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Properly clean up event watchers for ext-event and ext-libev
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#149 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Properly clean up event watchers for ext-event and ext-libev
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#149 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Minor code cleanup and remove unneeded references
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#145 by @seregazhuk)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Minor code cleanup and remove unneeded references
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#145 by @seregazhuk)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Discourage outdated ext-libevent on PHP 7
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#62 by @cboden)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Discourage outdated ext-libevent on PHP 7
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#62 by @cboden)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite by adding forward compatibility with PHPUnit 6 and PHPUnit 5,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite by adding forward compatibility with PHPUnit 6 and PHPUnit 5,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            lock Travis distro so new defaults will not break the build,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            improve test suite to be less fragile and increase test timeouts,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            test against PHP 7.2 and reduce fwrite() call length to one chunk.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#106 and #144 by @clue, #120 and #124 by @carusogabriel, #147 by nawarian and #92 by @kelunik)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#106 and #144 by @clue, #120 and #124 by @carusogabriel, #147 by nawarian and #92 by @kelunik)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            A number of changes were originally planned for this release but have been backported
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -to the last v0.4.3 already: #74, #76, #79, #81 (refs #65, #66, #67), #88 and #93

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            A number of changes were originally planned for this release but have been backported
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +to the last v0.4.3 already: #74, #76, #79, #81 (refs #65, #66, #67), #88 and #93

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -873,21 +562,21 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          This is a bug fix and improvement release:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bug fix: Bugfix in the usage sample code #57 (@dandelionred)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Remove branch-alias definition #53 (@WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: StreamSelectLoop: Use fresh time so Timers added during stream events are accurate #51 (@andrewminerd)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Avoid deprecation warnings in test suite due to deprecation of getMock() in PHPUnit #68 (@martinschroeder)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Add PHPUnit 4.8 to require-dev #69 (@shaunbramley)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Increase test timeouts for HHVM and unify timeout handling #70 (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Travis improvements (backported from #74) #75 (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Test suite now uses socket pairs instead of memory streams #66 (@martinschroeder)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: StreamSelectLoop: Test suite uses signal constant names in data provider #67 (@martinschroeder)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: ExtEventLoop: No longer suppress all errors #65 (@mamciek)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Readme cleanup #89 (@jsor)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Restructure and improve README #90 (@jsor)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bug fix: StreamSelectLoop: Fix erroneous zero-time sleep (backport to 0.4) #94 (@jsor)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This is a bug fix and improvement release:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Bug fix: Bugfix in the usage sample code #57 (@dandelionred)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: Remove branch-alias definition #53 (@WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: StreamSelectLoop: Use fresh time so Timers added during stream events are accurate #51 (@andrewminerd)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: Avoid deprecation warnings in test suite due to deprecation of getMock() in PHPUnit #68 (@martinschroeder)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: Add PHPUnit 4.8 to require-dev #69 (@shaunbramley)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: Increase test timeouts for HHVM and unify timeout handling #70 (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: Travis improvements (backported from #74) #75 (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: Test suite now uses socket pairs instead of memory streams #66 (@martinschroeder)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: StreamSelectLoop: Test suite uses signal constant names in data provider #67 (@martinschroeder)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: ExtEventLoop: No longer suppress all errors #65 (@mamciek)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: Readme cleanup #89 (@jsor)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: Restructure and improve README #90 (@jsor)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Bug fix: StreamSelectLoop: Fix erroneous zero-time sleep (backport to 0.4) #94 (@jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -910,11 +599,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This is a compatibility release that eases upgrading to the v0.4 release branch.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This is a compatibility release that eases upgrading to the v0.4 release branch.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            You should consider upgrading to the v0.4 release branch.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: Cap min timer interval at 1µs, thus improving compatibility with v0.4
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#47 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +(#47 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -932,11 +621,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: No longer error when signals sent to StreamSelectLoop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Support HHVM and PHP7 (@ondrejmirtes, @cebe)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Added support for EventConfig for ExtEventLoop (@steverhoades)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: Fixed an issue loading loop extension libs via autoloader (@czarpino)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Support HHVM and PHP7 (@ondrejmirtes, @cebe)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Added support for EventConfig for ExtEventLoop (@steverhoades)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: Fixed an issue loading loop extension libs via autoloader (@czarpino)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -959,8 +648,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: null timeout in StreamSelectLoop causing 100% CPU usage (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Bug fix: null timeout in StreamSelectLoop causing 100% CPU usage (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Bug fix: v0.3.4 changes merged for v0.4.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -979,13 +668,13 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: Added EventLoopInterface::nextTick(), implemented in all event loops (@jmalloc)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: Added EventLoopInterface::futureTick(), implemented in all event loops (@jmalloc)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: Added ExtEventLoop implementation using pecl/event (@jmalloc)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: Added EventLoopInterface::nextTick(), implemented in all event loops (@jmalloc)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: Added EventLoopInterface::futureTick(), implemented in all event loops (@jmalloc)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: Added ExtEventLoop implementation using pecl/event (@jmalloc)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • BC break: New method: EventLoopInterface::nextTick()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • BC break: New method: EventLoopInterface::futureTick()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • BC break: New method: EventLoopInterface::nextTick()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • BC break: New method: EventLoopInterface::futureTick()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1009,8 +698,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Bug fix: Changed StreamSelectLoop to use non-blocking behavior on tick() (@astephens25)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: Changed StreamSelectLoop to use non-blocking behavior on tick() (@astephens25)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1028,9 +717,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: No error on removing non-existent streams (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: Do not silently remove feof listeners in LibEvLoop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: No error on removing non-existent streams (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Do not silently remove feof listeners in LibEvLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1048,9 +737,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • BC break: New timers API (@nrk)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • BC break: Remove check on return value from stream callbacks (@nrk)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC break: New timers API (@nrk)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC break: Remove check on return value from stream callbacks (@nrk)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1068,9 +757,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Bug fix: Fix libevent timers with PHP 5.3
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Bug fix: Fix libevent timer cancellation (@nrk)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Bug fix: Fix libevent timer cancellation (@nrk)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1093,8 +782,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Bug fix: Plug memory issue in libevent timers (@cameronjacobson)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Bug fix: Plug memory issue in libevent timers (@cameronjacobson)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Bug fix: Correctly pause LibEvLoop on stop()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1113,8 +802,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: LibEvLoop, integration of php-libev
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: LibEvLoop, integration of php-libev

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1132,7 +821,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1151,7 +840,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1170,7 +859,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1191,8 +880,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      EventLoop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      diff --git a/event-loop/index.html b/event-loop/index.html index 9b32ed557..9f68a84f7 100644 --- a/event-loop/index.html +++ b/event-loop/index.html @@ -5,7 +5,8 @@ - EventLoop - ReactPHP + EventLoop: +EventLoop Component - ReactPHP @@ -20,13 +21,13 @@ - - + + - - - + + + @@ -40,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -219,32 +202,23 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                CI status -installs on Packagist

                                                                                                                                                                                                                                                                                                                                                                                                                                                                + +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Build Status

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ReactPHP's core reactor event loop that libraries can use for evented I/O.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In order for async based libraries to be interoperable, they need to use the same event loop. This component provides a common LoopInterface that any library can target. This allows them to be used in the same loop, with one single run() call that is controlled by the user.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Table of contents

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Table of Contents

                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Quickstart example
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Usage -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Quickstart example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Quickstart example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Here is an async HTTP server built with just the event loop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  <?php
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -use React\EventLoop\Loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -require __DIR__ . '/vendor/autoload.php';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$server = stream_socket_server('tcp://127.0.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -stream_set_blocking($server, false);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Loop::addReadStream($server, function ($server) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $conn = stream_socket_accept($server);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $data = "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n\r\nHi\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    Loop::addWriteStream($conn, function ($conn) use (&$data) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        $written = fwrite($conn, $data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        if ($written === strlen($data)) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -            fclose($conn);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -            Loop::removeWriteStream($conn);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -            $data = substr($data, $written);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Loop::addPeriodicTimer(5, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $memory = memory_get_usage() / 1024;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $formatted = number_format($memory, 3).'K';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo "Current memory usage: {$formatted}\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Typical applications would use the Loop class to use the default -event loop like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  use React\EventLoop\Loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$timer = Loop::addPeriodicTimer(0.1, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Tick' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Loop::addTimer(1.0, function () use ($timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    Loop::cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Done' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  As an alternative, you can also explicitly create an event loop instance at the -beginning, reuse it throughout your program and finally run it at the end of the -program like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $loop = React\EventLoop\Loop::get(); // or deprecated React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$timer = $loop->addPeriodicTimer(0.1, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Tick' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$loop->addTimer(1.0, function () use ($loop, $timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $loop->cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Done' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  While the former is more concise, the latter is more explicit. -In both cases, the program would perform the exact same steps.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$server = stream_socket_server('tcp://127.0.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +stream_set_blocking($server, false);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$loop->addReadStream($server, function ($server) use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    $conn = stream_socket_accept($server);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    $data = "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n\r\nHi\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    $loop->addWriteStream($conn, function ($conn) use (&$data, $loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        $written = fwrite($conn, $data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        if ($written === strlen($data)) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +            fclose($conn);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +            $loop->removeWriteStream($conn);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +            $data = substr($data, $written);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$loop->addPeriodicTimer(5, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    $memory = memory_get_usage() / 1024;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    $formatted = number_format($memory, 3).'K';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    echo "Current memory usage: {$formatted}\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Typical applications use a single event loop which is created at the beginning +and run at the end of the program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // [1]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +// [2]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$loop->addPeriodicTimer(1, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    echo "Tick\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$stream = new React\Stream\ReadableResourceStream(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    fopen('file.txt', 'r'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    $loop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +// [3]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  1. The event loop instance is created at the beginning of the program. This is -implicitly done the first time you call the Loop class or -explicitly when using the deprecated Factory::create() method -(or manually instantiating any of the loop implementations).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  2. -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  3. The event loop is used directly or passed as an instance to library and -application code. In this example, a periodic timer is registered with the -event loop which simply outputs Tick every fraction of a second until another -timer stops the periodic timer after a second.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  4. -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  5. The event loop is run at the end of the program. This is automatically done -when using the Loop class or explicitly with a single run() -call at the end of the program.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  6. +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  7. The loop instance is created at the beginning of the program. A convenience +factory React\EventLoop\Factory::create() is provided by this library which +picks the best available loop implementation.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  8. +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  9. The loop instance is used directly or passed to library and application code. +In this example, a periodic timer is registered with the event loop which +simply outputs Tick every second and a +readable stream +is created by using ReactPHP's +stream component for demonstration +purposes.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  10. +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  11. The loop is run with a single $loop->run() call at the end of the program.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  As of v1.2.0, we highly recommend using the Loop class. -The explicit loop instructions are still valid and may still be useful in some -applications, especially for a transition period towards the more concise style.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Loop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The Loop class exists as a convenient global accessor for the event loop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Loop methods

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The Loop class provides all methods that exist on the LoopInterface -as static methods:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  If you're working with the event loop in your application code, it's often -easiest to directly interface with the static methods defined on the Loop class -like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  use React\EventLoop\Loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$timer = Loop::addPeriodicTimer(0.1, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Tick' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Loop::addTimer(1.0, function () use ($timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    Loop::cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Done' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  On the other hand, if you're familiar with object-oriented programming (OOP) and -dependency injection (DI), you may want to inject an event loop instance and -invoke instance methods on the LoopInterface like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  use React\EventLoop\Loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -use React\EventLoop\LoopInterface;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -class Greeter
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    private $loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    public function __construct(LoopInterface $loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        $this->loop = $loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    public function greet(string $name)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        $this->loop->addTimer(1.0, function () use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -            echo 'Hello ' . $name . '!' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$greeter = new Greeter(Loop::get());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$greeter->greet('Alice');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$greeter->greet('Bob');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Each static method call will be forwarded as-is to the underlying event loop -instance by using the Loop::get() call internally. -See LoopInterface for more details about available methods.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Loop autorun

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  When using the Loop class, it will automatically execute the loop at the end of -the program. This means the following example will schedule a timer and will -automatically execute the program until the timer event fires:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  use React\EventLoop\Loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Loop::addTimer(1.0, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Hello' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  As of v1.2.0, we highly recommend using the Loop class this way and omitting any -explicit run() calls. For BC reasons, the explicit run() -method is still valid and may still be useful in some applications, especially -for a transition period towards the more concise style.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  If you don't want the Loop to run automatically, you can either explicitly -run() or stop() it. This can be useful if you're using -a global exception handler like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  use React\EventLoop\Loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Loop::addTimer(10.0, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Never happens';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -set_exception_handler(function (Throwable $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    Loop::stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -throw new RuntimeException('Demo');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  get()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The get(): LoopInterface method can be used to -get the currently active event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  This method will always return the same event loop instance throughout the -lifetime of your application.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  use React\EventLoop\Loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -use React\EventLoop\LoopInterface;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$loop = Loop::get();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -assert($loop instanceof LoopInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -assert($loop === Loop::get());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  This is particularly useful if you're using object-oriented programming (OOP) -and dependency injection (DI). In this case, you may want to inject an event -loop instance and invoke instance methods on the LoopInterface like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  use React\EventLoop\Loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -use React\EventLoop\LoopInterface;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -class Greeter
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    private $loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    public function __construct(LoopInterface $loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        $this->loop = $loop;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    public function greet(string $name)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        $this->loop->addTimer(1.0, function () use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -            echo 'Hello ' . $name . '!' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$greeter = new Greeter(Loop::get());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$greeter->greet('Alice');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$greeter->greet('Bob');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  See LoopInterface for more details about available methods.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Factory

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Deprecated since v1.2.0, see Loop class instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The deprecated Factory class exists as a convenient way to pick the best available +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Factory

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The Factory class exists as a convenient way to pick the best available event loop implementation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  create()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Deprecated since v1.2.0, see Loop::get() instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The deprecated create(): LoopInterface method can be used to -create a new event loop instance:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$loop = React\EventLoop\Loop::get();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +create()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The create(): LoopInterface method can be used to create a new event loop +instance:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $loop = React\EventLoop\Factory::create();

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  This method always returns an instance implementing LoopInterface, the actual event loop implementation is an implementation detail.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  This method should usually only be called once at the beginning of the program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Loop implementations

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Loop implementations

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  In addition to the LoopInterface, there are a number of event loop implementations provided.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  All of the event loops support these features:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -519,21 +342,21 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                For most consumers of this package, the underlying event loop implementation is an implementation detail. -You should use the Loop class to automatically create a new instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +You should use the Factory to automatically create a new instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced! If you explicitly need a certain event loop implementation, you can manually instantiate one of the following classes. Note that you may have to install the required PHP extensions for the respective event loop implementation first or they will throw a BadMethodCallException on creation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                StreamSelectLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +StreamSelectLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                A stream_select() based event loop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This uses the stream_select() -function and is the only implementation that works out of the box with PHP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This event loop works out of the box on PHP 5.3 through PHP 8+ and HHVM. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This uses the stream_select() +function and is the only implementation which works out of the box with PHP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This event loop works out of the box on PHP 5.3 through PHP 7+ and HHVM. This means that no installation is required and this library works on all platforms and supported PHP versions. -Accordingly, the Loop class and the deprecated Factory -will use this event loop by default if you do not install any of the event loop -extensions listed below.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Accordingly, the Factory will use this event loop by default if +you do not install any of the event loop extensions listed below.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Under the hood, it does a simple select system call. This system call is limited to the maximum file descriptor number of FD_SETSIZE (platform dependent, commonly 1024) and scales with O(m) @@ -551,47 +374,37 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                It is commonly installed as part of many PHP distributions. If this extension is missing (or you're running on Windows), signal handling is not supported and throws a BadMethodCallException instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This event loop is known to rely on wall-clock time to schedule future timers -when using any version before PHP 7.3, because a monotonic time source is -only available as of PHP 7.3 (hrtime()). +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This event loop is known to rely on wall-clock time to schedule future +timers, because a monotonic time source is not available in PHP by default. While this does not affect many common use cases, this is an important distinction for programs that rely on a high time precision or on systems that are subject to discontinuous time adjustments (time jumps). -This means that if you schedule a timer to trigger in 30s on PHP < 7.3 and -then adjust your system time forward by 20s, the timer may trigger in 10s. +This means that if you schedule a timer to trigger in 30s and then adjust +your system time forward by 20s, the timer may trigger in 10s. See also addTimer() for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ExtEventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +ExtEventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                An ext-event based event loop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This uses the event PECL extension, -that provides an interface to libevent library. -libevent itself supports a number of system-specific backends (epoll, kqueue).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This loop is known to work with PHP 5.4 through PHP 8+.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ExtEvLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This uses the event PECL extension. +It supports the same backends as libevent.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This loop is known to work with PHP 5.4 through PHP 7+.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +ExtEvLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                An ext-ev based event loop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This loop uses the ev PECL extension, -that provides an interface to libev library. -libev itself supports a number of system-specific backends (epoll, kqueue).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This loop is known to work with PHP 5.4 through PHP 8+.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ExtUvLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                An ext-uv based event loop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This loop uses the uv PECL extension, -that provides an interface to libuv library. -libuv itself supports a number of system-specific backends (epoll, kqueue).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This loop is known to work with PHP 7+.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ExtLibeventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Deprecated since v1.2.0, use ExtEventLoop instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This loop uses the ev PECL extension, that +provides an interface to libev library.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This loop is known to work with PHP 5.4 through PHP 7+.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +ExtLibeventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                An ext-libevent based event loop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This uses the libevent PECL extension, -that provides an interface to libevent library. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This uses the libevent PECL extension. libevent itself supports a number of system-specific backends (epoll, kqueue).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This event loop does only work with PHP 5. An unofficial update for PHP 7 does exist, but it is known to cause regular crashes due to SEGFAULTs. To reiterate: Using this event loop on PHP 7 is not recommended. -Accordingly, neither the Loop class nor the deprecated -Factory class will try to use this event loop on PHP 7.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Accordingly, the Factory will not try to use this event loop on +PHP 7.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This event loop is known to trigger a readable listener only if the stream becomes readable (edge-triggered) and may not trigger if the stream has already been readable from the beginning. @@ -600,27 +413,26 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                As such, it's recommended to use stream_set_read_buffer($stream, 0); to disable PHP's internal read buffer in this case. See also addReadStream() for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ExtLibevLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Deprecated since v1.2.0, use ExtEvLoop instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +ExtLibevLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                An ext-libev based event loop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This uses an unofficial libev extension, -that provides an interface to libev library. -libev itself supports a number of system-specific backends (epoll, kqueue).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This uses an unofficial libev extension. +It supports the same backends as libevent.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This loop does only work with PHP 5. An update for PHP 7 is unlikely to happen any time soon.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                LoopInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                run()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +LoopInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +run()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The run(): void method can be used to run the event loop until there are no more tasks to perform.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                For many applications, this method is the only directly visible invocation on the event loop. -As a rule of thumb, it is usually recommended to attach everything to the +As a rule of thumb, it is usally recommended to attach everything to the same loop instance and then run the loop once at the bottom end of the application.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->run();

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method will keep the loop running until there are no more tasks to perform. In other words: This method will block until the last timer, stream and/or signal has been removed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -629,55 +441,54 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                run it will result in the application exiting without actually waiting for any of the attached listeners.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method MUST NOT be called while the loop is already running. -This method MAY be called more than once after it has explicitly been +This method MAY be called more than once after it has explicity been stop()ped or after it automatically stopped because it previously did no longer have anything to do.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                stop()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +stop()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The stop(): void method can be used to instruct a running event loop to stop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method is considered advanced usage and should be used with care. As a rule of thumb, it is usually recommended to let the loop stop only automatically when it no longer has anything to do.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method can be used to explicitly instruct the event loop to stop:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->addTimer(3.0, function () use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $loop->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->addTimer(3.0, function () use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $loop->stop();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Calling this method on a loop instance that is not currently running or on a loop instance that has already been stopped has no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                addTimer()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +addTimer()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The addTimer(float $interval, callable $callback): TimerInterface method can be used to enqueue a callback to be invoked once after the given interval.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The second parameter MUST be a timer callback function that accepts -the timer instance as its only parameter. -If you don't use the timer instance inside your timer callback function -you MAY use a function which has no parameters at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The timer callback function MUST be able to accept a single parameter, +the timer instance as also returned by this method or you MAY use a +function which has no parameters at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The timer callback function MUST NOT throw an Exception. The return value of the timer callback function will be ignored and has no effect, so for performance reasons you're recommended to not return any excessive data structures.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method returns a timer instance. The same timer instance will also be -passed into the timer callback function as described above. -You can invoke cancelTimer to cancel a pending timer. -Unlike addPeriodicTimer(), this method will ensure -the callback will be invoked only once after the given interval.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->addTimer(0.8, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'world!' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$loop->addTimer(0.3, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'hello ';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #1.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Unlike addPeriodicTimer(), this method will ensure +the callback will be invoked only once after the given interval. +You can invoke cancelTimer to cancel a pending timer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->addTimer(0.8, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'world!' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->addTimer(0.3, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'hello ';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #1.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to access any variables within your callback function, you can bind arbitrary data to a callback closure like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                function hello($name, LoopInterface $loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $loop->addTimer(1.0, function () use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo "hello $name\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -hello('Tester', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                function hello($name, LoopInterface $loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $loop->addTimer(1.0, function () use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        echo "hello $name\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +hello('Tester', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This interface does not enforce any particular timer resolution, so special care may have to be taken if you rely on very high precision with millisecond accuracy or below. Event loop implementations SHOULD work on @@ -689,55 +500,53 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                same time (within its possible accuracy) is not guaranteed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This interface suggests that event loop implementations SHOULD use a monotonic time source if available. Given that a monotonic time source is -only available as of PHP 7.3 by default, event loop implementations MAY -fall back to using wall-clock time. +not available on PHP by default, event loop implementations MAY fall back +to using wall-clock time. While this does not affect many common use cases, this is an important distinction for programs that rely on a high time precision or on systems that are subject to discontinuous time adjustments (time jumps). This means that if you schedule a timer to trigger in 30s and then adjust your system time forward by 20s, the timer SHOULD still trigger in 30s. See also event loop implementations for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                addPeriodicTimer()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +addPeriodicTimer()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The addPeriodicTimer(float $interval, callable $callback): TimerInterface method can be used to enqueue a callback to be invoked repeatedly after the given interval.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The second parameter MUST be a timer callback function that accepts -the timer instance as its only parameter. -If you don't use the timer instance inside your timer callback function -you MAY use a function which has no parameters at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The timer callback function MUST be able to accept a single parameter, +the timer instance as also returned by this method or you MAY use a +function which has no parameters at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The timer callback function MUST NOT throw an Exception. The return value of the timer callback function will be ignored and has no effect, so for performance reasons you're recommended to not return any excessive data structures.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method returns a timer instance. The same timer instance will also be -passed into the timer callback function as described above. -Unlike addTimer(), this method will ensure the callback -will be invoked infinitely after the given interval or until you invoke -cancelTimer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $timer = $loop->addPeriodicTimer(0.1, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'tick!' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$loop->addTimer(1.0, function () use ($loop, $timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $loop->cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Done' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #2.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Unlike addTimer(), this method will ensure the the +callback will be invoked infinitely after the given interval or until you +invoke cancelTimer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $timer = $loop->addPeriodicTimer(0.1, function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'tick!' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->addTimer(1.0, function () use ($loop, $timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $loop->cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'Done' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #2.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to limit the number of executions, you can bind arbitrary data to a callback closure like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                function hello($name, LoopInterface $loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $n = 3;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $loop->addPeriodicTimer(1.0, function ($timer) use ($name, $loop, &$n) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        if ($n > 0) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            --$n;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            echo "hello $name\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            $loop->cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -hello('Tester', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                function hello($name, LoopInterface $loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $n = 3;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $loop->addPeriodicTimer(1.0, function ($timer) use ($name, $loop, &$n) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        if ($n > 0) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            --$n;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            echo "hello $name\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            $loop->cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +hello('Tester', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This interface does not enforce any particular timer resolution, so special care may have to be taken if you rely on very high precision with millisecond accuracy or below. Event loop implementations SHOULD work on @@ -749,8 +558,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                same time (within its possible accuracy) is not guaranteed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This interface suggests that event loop implementations SHOULD use a monotonic time source if available. Given that a monotonic time source is -only available as of PHP 7.3 by default, event loop implementations MAY -fall back to using wall-clock time. +not available on PHP by default, event loop implementations MAY fall back +to using wall-clock time. While this does not affect many common use cases, this is an important distinction for programs that rely on a high time precision or on systems that are subject to discontinuous time adjustments (time jumps). @@ -761,13 +570,15 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                re-scheduling after each invocation. As such, it's generally not recommended to rely on this for high precision intervals with millisecond accuracy or below.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                cancelTimer()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +cancelTimer()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The cancelTimer(TimerInterface $timer): void method can be used to cancel a pending timer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also addPeriodicTimer() and example #2.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also addPeriodicTimer() and example #2.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Calling this method on a timer instance that has not been added to this loop instance or on a timer that has already been cancelled has no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                futureTick()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +futureTick()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The futureTick(callable $listener): void method can be used to schedule a callback to be invoked on a future tick of the event loop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This works very much similar to timers with an interval of zero seconds, @@ -779,57 +590,59 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                any excessive data structures.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to access any variables within your callback function, you can bind arbitrary data to a callback closure like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                function hello($name, LoopInterface $loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $loop->futureTick(function () use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo "hello $name\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -hello('Tester', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                function hello($name, LoopInterface $loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $loop->futureTick(function () use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        echo "hello $name\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +hello('Tester', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Unlike timers, tick callbacks are guaranteed to be executed in the order they are enqueued. Also, once a callback is enqueued, there's no way to cancel this operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is often used to break down bigger tasks into smaller steps (a form of cooperative multitasking).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->futureTick(function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'b';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$loop->futureTick(function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'c';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -echo 'a';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #3.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                addSignal()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->futureTick(function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'b';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->futureTick(function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'c';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +echo 'a';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #3.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +addSignal()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The addSignal(int $signal, callable $listener): void method can be used to register a listener to be notified when a signal has been caught by this process.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is useful to catch user interrupt signals or shutdown signals from tools like supervisor or systemd.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The second parameter MUST be a listener callback function that accepts -the signal as its only parameter. -If you don't use the signal inside your listener callback function -you MAY use a function which has no parameters at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The listener callback function MUST be able to accept a single parameter, +the signal added by this method or you MAY use a function which +has no parameters at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The listener callback function MUST NOT throw an Exception. The return value of the listener callback function will be ignored and has no effect, so for performance reasons you're recommended to not return any excessive data structures.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->addSignal(SIGINT, function (int $signal) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Caught user interrupt signal' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #4.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Signaling is only available on Unix-like platforms, Windows isn't +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->addSignal(SIGINT, function (int $signal) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'Caught user interrupt signal' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #4.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Signaling is only available on Unix-like platform, Windows isn't supported due to operating system limitations. This method may throw a BadMethodCallException if signals aren't supported on this platform, for example when required extensions are missing.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note: A listener can only be added once to the same signal, any -attempts to add it more than once will be ignored.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                removeSignal()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +attempts to add it more then once will be ignored.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +removeSignal()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The removeSignal(int $signal, callable $listener): void method can be used to remove a previously added signal listener.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->removeSignal(SIGINT, $listener);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->removeSignal(SIGINT, $listener);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Any attempts to remove listeners that aren't registered will be ignored.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                addReadStream()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +addReadStream()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced! Note that this low-level API is considered advanced usage. Most use cases should probably use the higher-level @@ -845,20 +658,19 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                react to this event with a single listener and then dispatch from this listener. This method MAY throw an Exception if the given resource type is not supported by this loop implementation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The second parameter MUST be a listener callback function that accepts -the stream resource as its only parameter. -If you don't use the stream resource inside your listener callback function -you MAY use a function which has no parameters at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The listener callback function MUST be able to accept a single parameter, +the stream resource added by this method or you MAY use a function which +has no parameters at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The listener callback function MUST NOT throw an Exception. The return value of the listener callback function will be ignored and has no effect, so for performance reasons you're recommended to not return any excessive data structures.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to access any variables within your callback function, you can bind arbitrary data to a callback closure like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->addReadStream($stream, function ($stream) use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo $name . ' said: ' . fread($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #11.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->addReadStream($stream, function ($stream) use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo $name . ' said: ' . fread($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #11.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can invoke removeReadStream() to remove the read event listener for this stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The execution order of listeners when multiple streams become ready at @@ -870,7 +682,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                is still left in PHP's internal stream buffers. As such, it's recommended to use stream_set_read_buffer($stream, 0); to disable PHP's internal read buffer in this case.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                addWriteStream()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +addWriteStream()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced! Note that this low-level API is considered advanced usage. Most use cases should probably use the higher-level @@ -886,56 +699,61 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop

                                                                                                                                                                                                                                                                                                                                                                                                                                                                react to this event with a single listener and then dispatch from this listener. This method MAY throw an Exception if the given resource type is not supported by this loop implementation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The second parameter MUST be a listener callback function that accepts -the stream resource as its only parameter. -If you don't use the stream resource inside your listener callback function -you MAY use a function which has no parameters at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The listener callback function MUST be able to accept a single parameter, +the stream resource added by this method or you MAY use a function which +has no parameters at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The listener callback function MUST NOT throw an Exception. The return value of the listener callback function will be ignored and has no effect, so for performance reasons you're recommended to not return any excessive data structures.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to access any variables within your callback function, you can bind arbitrary data to a callback closure like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->addWriteStream($stream, function ($stream) use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    fwrite($stream, 'Hello ' . $name);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #12.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop->addWriteStream($stream, function ($stream) use ($name) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    fwrite($stream, 'Hello ' . $name);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #12.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can invoke removeWriteStream() to remove the write event listener for this stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The execution order of listeners when multiple streams become ready at the same time is not guaranteed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                removeReadStream()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +removeReadStream()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The removeReadStream(resource $stream): void method can be used to remove the read event listener for the given stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Removing a stream from the loop that has already been removed or trying to remove a stream that was never added or is invalid has no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                removeWriteStream()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +removeWriteStream()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The removeWriteStream(resource $stream): void method can be used to remove the write event listener for the given stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Removing a stream from the loop that has already been removed or trying to remove a stream that was never added or is invalid has no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This project follows SemVer. This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                composer require react/event-loop:^1.6
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer require react/event-loop:^1.0

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.3 through current PHP 8+ and +extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. -It's highly recommended to use the latest supported PHP version for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +It's highly recommended to use PHP 7+ for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Installing any of the event loop extensions is suggested, but entirely optional. See also event loop implementations for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ php vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                More

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +More

                                                                                                                                                                                                                                                                                                                                                                                                                                                                • See our Stream component for more information on how streams are used in real-world applications.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • @@ -950,8 +768,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  EventLoop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  diff --git a/event-loop/license.html b/event-loop/license.html index 4571ae876..f7ba7ddc0 100644 --- a/event-loop/license.html +++ b/event-loop/license.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -40,7 +40,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -219,8 +201,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The MIT License (MIT)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2012 Christian Lück, Cees-Jan Kiewiet, Jan Sorgalla, Chris Boden, Igor Wiedler

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2012 Igor Wiedler, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -243,8 +224,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                EventLoop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                diff --git a/http-client/changelog.html b/http-client/changelog.html index e296db56e..416246fd6 100644 --- a/http-client/changelog.html +++ b/http-client/changelog.html @@ -5,9 +5,9 @@ - HttpClient: Changelog - ReactPHP + HTTPClient: Changelog - ReactPHP - + @@ -20,14 +20,14 @@ - - + + - - - - + + + + @@ -41,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -218,11 +200,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HttpClient Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTPClient Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2021 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.5.11 - - - (2021-04-07) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Minimal fix for PHP 8
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#154 by @remicollet)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Documentation: Add deprecation notice to suggest HTTP component instead
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#153 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2020 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.5.10 - - - (2020-01-14) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Avoid unneeded warning when decoding invalid data on PHP 7.4.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#150 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Add .gitattributes to exclude dev files from exports.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#149 by @reedy)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Link to clue/reactphp-buzz for higher-level HTTP client.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#139 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite by simplifying test matrix and test setup.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#151 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                2018

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -321,14 +231,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Support legacy HTTP servers that use only LF instead of CRLF.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#130 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Support legacy HTTP servers that use only LF instead of CRLF.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#130 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve test suite by applying maximum test timeouts for integration tests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#131 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve test suite by applying maximum test timeouts for integration tests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#131 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -347,15 +257,15 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Support legacy PHP 5.3 through PHP 7.2 and HHVM
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#126 and #127 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Support legacy PHP 5.3 through PHP 7.2 and HHVM
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#126 and #127 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve backwards compatibility with Promise v1 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve backwards compatibility with Promise v1 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      use RingCentral to improve interoperability with react/http.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#124 and #125 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#124 and #125 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -374,22 +284,22 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Fix: Ignore excessive whitespace in chunk header for Transfer-Encoding: chunked
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#123 by @DangerLifter and @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Fix: Ignore excessive whitespace in chunk header for Transfer-Encoding: chunked
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#123 by @DangerLifter and @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Fix: Ignore invalid incoming Transfer-Encoding response header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#122 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Fix: Ignore invalid incoming Transfer-Encoding response header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#122 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Improve documentation for Client (and advanced Connector)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#111 by @jsor and #121 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Improve documentation for Client (and advanced Connector)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#111 by @jsor and #121 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Improve test suite by adding support for PHPUnit 6
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#112 by @carusogabriel)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Improve test suite by adding support for PHPUnit 6
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#112 by @carusogabriel)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -413,9 +323,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Feature: Update Socket component to support HTTP over Unix domain sockets (UDS)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#110 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +(#110 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -433,9 +343,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Fix: Update Socket component to work around sending secure HTTPS requests with PHP < 7.1.4
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#109 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +(#109 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -453,18 +363,18 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Feature: Update Socket dependency to support hosts file on all platforms
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#108 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              This means that HTTP requests to hosts such as localhost will now work as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Feature: Update Socket dependency to support hosts file on all platforms
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#108 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              This means that HTTP requests to hosts such as localhost will now work as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              expected across all platforms with no changes required:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              $client = new Client($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$request = $client->request('GET', 'http://localhost/');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$request->on('response', function (Response $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    // …
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$request->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              $client = new Client($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$request = $client->request('GET', 'http://localhost/');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$request->on('response', function (Response $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    //
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$request->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -483,14 +393,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Target evenement 3.0 a long side 2.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#106 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Target evenement 3.0 a long side 2.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#106 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite by locking Travis distro so new defaults will not break the build
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#105 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite by locking Travis distro so new defaults will not break the build
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#105 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -509,14 +419,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support passing arrays for request header values
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#100 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support passing arrays for request header values
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#100 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix merging default headers if overwritten with custom case headers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#101 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix merging default headers if overwritten with custom case headers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#101 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -535,18 +445,18 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Emit error event if request URL is invalid
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#99 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Emit error event if request URL is invalid
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#99 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Support OPTIONS method with asterisk-form (OPTIONS * HTTP/1.1)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#98 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Support OPTIONS method with asterisk-form (OPTIONS * HTTP/1.1)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#98 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve documentation for event semantics
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#97 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve documentation for event semantics
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#97 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -565,41 +475,41 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / BC break: Replace Factory with simple Client constructor
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#85 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The Client now accepts a required LoopInterface and an optional
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -ConnectorInterface. It will now create a default Connector if none
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / BC break: Replace Factory with simple Client constructor
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#85 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The Client now accepts a required LoopInterface and an optional
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +ConnectorInterface. It will now create a default Connector if none
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      has been given.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$dnsResolver = $dnsResolverFactory->createCached('8.8.8.8', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$factory = new React\HttpClient\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$client = $factory->create($loop, $dnsResolver);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$client = new React\HttpClient\Client($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$dnsResolver = $dnsResolverFactory->createCached('8.8.8.8', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$factory = new React\HttpClient\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$client = $factory->create($loop, $dnsResolver);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$client = new React\HttpClient\Client($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Request::close() now cancels pending connection attempt
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#91 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Request::close() now cancels pending connection attempt
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#91 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / BC break: Replace deprecated SocketClient with new Socket component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#74, #84 and #88 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / BC break: Replace deprecated SocketClient with new Socket component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#74, #84 and #88 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / BC break: Consistent stream semantics and forward compatibility with upcoming Stream v1.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#90 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / BC break: Consistent stream semantics and forward compatibility with upcoming Stream v1.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#90 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Forward compatibility with upcoming EventLoop v1.0 and v0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#89 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Forward compatibility with upcoming EventLoop v1.0 and v0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#89 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Fix: Catch Guzzle parser exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#82 by @djagya)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Fix: Catch Guzzle parser exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#82 by @djagya)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -618,9 +528,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Improvement: Add PHPUnit to require-dev #75 @jsor
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Fix: Fix chunk header to be case-insensitive and allow leading zeros for end chunk #77 @mdrost
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Improvement: Add PHPUnit to require-dev #75 @jsor
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Fix: Fix chunk header to be case-insensitive and allow leading zeros for end chunk #77 @mdrost

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -638,8 +548,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Fix: Trim leading zeros from chunk size #73 @maciejmrozinski
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -662,9 +572,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Improvement: Add examples #69 @clue
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Fix: Ensure checking for 0 length chunk, when we should check for it #71 @WyriHaximus
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Add examples #69 @clue
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Fix: Ensure checking for 0 length chunk, when we should check for it #71 @WyriHaximus

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -682,8 +592,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Fix: Ensure the first bit of body directly after the headers is emitted into the stream #68 @WyriHaximus
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Fix: Ensure the first bit of body directly after the headers is emitted into the stream #68 @WyriHaximus

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -701,8 +611,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Fix: Ensure Request emits initial Response data as string #66 @mmelvin0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Fix: Ensure Request emits initial Response data as string #66 @mmelvin0

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -720,8 +630,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Fix: Changed $stream from DuplexStreamInterface to ReadableStreamInterface in Response constructor #63 @WyriHaximus
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Fix: Changed $stream from DuplexStreamInterface to ReadableStreamInterface in Response constructor #63 @WyriHaximus

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -739,8 +649,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Chunked encoding @WyriHaximus
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -758,9 +668,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Improvement: Broader guzzle/parser version req @cboden
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Improvement: Improve forwards compatibility with all supported versions @clue
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Improvement: Broader guzzle/parser version req @cboden
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Improvement: Improve forwards compatibility with all supported versions @clue

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -778,8 +688,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Improvement: Update react/socket-client dependency to all supported versions @clue
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Improvement: Update react/socket-client dependency to all supported versions @clue

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -797,9 +707,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Improvement: PHP 7 memory leak, related to PHP bug 71737 @jmalloc
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Improvement: Clean up all listeners when closing request @weichenlin
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Improvement: PHP 7 memory leak, related to PHP bug 71737 @jmalloc
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Improvement: Clean up all listeners when closing request @weichenlin

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -822,8 +732,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Improvement: Avoid hiding exceptions thrown in HttpClient\Request error handlers @arnaud-lb
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Avoid hiding exceptions thrown in HttpClient\Request error handlers @arnaud-lb

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -841,8 +751,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improvement: Set protocol version on request creation @WyriHaximus
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: Set protocol version on request creation @WyriHaximus

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -860,8 +770,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improvement: Support explicitly using HTTP/1.1 protocol version @clue
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Improvement: Support explicitly using HTTP/1.1 protocol version @clue

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -879,8 +789,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Improvement: Replaced the abandoned guzzle/parser with guzzlehttp/psr7 @WyriHaximus
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Improvement: Replaced the abandoned guzzle/parser with guzzlehttp/psr7 @WyriHaximus

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -898,8 +808,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Improvement: Emit drain event when the request is ready to receive more data by @arnaud-lb
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Improvement: Emit drain event when the request is ready to receive more data by @arnaud-lb

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -917,8 +827,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Improvement: Added support for using auth informations from URL by @arnaud-lb
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Improvement: Added support for using auth informations from URL by @arnaud-lb

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -936,8 +846,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Improvement: Pass Response object on with data emit by @dpovshed
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Improvement: Pass Response object on with data emit by @dpovshed

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -960,9 +870,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Improvement: Use EventEmitterTrait instead of base class by @cursedcoder
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Improvement: Changed Stream to DuplexStreamInterface in Response::__construct by @mbonneau
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Improvement: Use EventEmitterTrait instead of base class by @cursedcoder
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Improvement: Changed Stream to DuplexStreamInterface in Response::__construct by @mbonneau

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -980,10 +890,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • BC break: Drop unused Response::getBody()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC break: Drop unused Response::getBody()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC break: Remove $loop argument from HttpClient: Client, Request, Response
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC break: Remove $loop argument from HttpClient: Client, Request, Response
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bump React dependencies to v0.4
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • @@ -1009,7 +919,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Bug fix: Correct requirement for socket-client
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1028,7 +938,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • BC break: Socket connection handling moved to new SocketClient component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bump React dependencies to v0.3
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1053,7 +963,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1072,7 +982,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: Use a promise-based API internally
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Bug fix: Use DNS resolver correctly
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1092,7 +1002,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1111,8 +1021,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Feature: HTTP client (@arnaud-lb)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1129,11 +1039,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -217,38 +200,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HttpClient

                                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Deprecation notice

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This package has now been migrated over to -react/http -and only exists for BC reasons.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer require react/http
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you've previously used this package, upgrading may take a moment or two. -The new API has been updated to use Promises and PSR-7 message abstractions. -This means it's now more powerful and easier to use than ever:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$client = new React\HttpClient\Client($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$request = $client->request('GET', 'https://example.com/');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$request->on('response', function ($response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $response->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$request->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo $response->getBody();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See react/http for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The below documentation applies to the last release of this package. -Further development will take place in the updated -react/http, -so you're highly recommended to upgrade as soon as possible.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Deprecated HttpClient

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Build Status

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTPClient

                                                                                                                                                                                                                                                                                                                                                                                                                                                                + + +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Build Status

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Event-driven, streaming HTTP client for ReactPHP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Table of Contents

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Basic usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Client

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Basic usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Client

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The Client is responsible for communicating with HTTP servers, managing the connection state and sending your HTTP requests. It also registers everything with the main EventLoop.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$client = new Client($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$client = new Client($loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you need custom connector settings (DNS resolution, TLS parameters, timeouts, proxy servers etc.), you can explicitly pass a custom instance of the ConnectorInterface:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector = new \React\Socket\Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'dns' => '127.0.0.1',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tcp' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'bindto' => '192.168.10.1:0'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'verify_peer' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'verify_peer_name' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$client = new Client($loop, $connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector = new \React\Socket\Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'dns' => '127.0.0.1',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'tcp' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'bindto' => '192.168.10.1:0'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'verify_peer' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'verify_peer_name' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$client = new Client($loop, $connector);

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The request(string $method, string $uri, array $headers = array(), string $version = '1.0'): Request method can be used to prepare new Request objects.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The optional $headers parameter can be used to pass additional request @@ -352,55 +309,60 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HttpClient

                                                                                                                                                                                                                                                                                                                                                                                                                                                                preceeded by an error event. This will also be forwarded to the request and emit a close event there.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Example

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              <?php
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$client = new React\HttpClient\Client($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$request = $client->request('GET', 'https://github.com/');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$request->on('response', function ($response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $response->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $response->on('end', function() {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        echo 'DONE';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$request->on('error', function (\Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    echo $e;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$request->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Unix domain sockets

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Example

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              <?php
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$client = new React\HttpClient\Client($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$request = $client->request('GET', 'https://github.com/');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$request->on('response', function ($response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $response->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $response->on('end', function() {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        echo 'DONE';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$request->on('error', function (\Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    echo $e;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$request->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Advanced Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Unix domain sockets

                                                                                                                                                                                                                                                                                                                                                                                                                                                              By default, this library supports transport over plaintext TCP/IP and secure TLS connections for the http:// and https:// URI schemes respectively. This library also supports Unix domain sockets (UDS) when explicitly configured.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              In order to use a UDS path, you have to explicitly configure the connector to override the destination URI so that the hostname given in the request URI will no longer be used to establish the connection:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new FixedUriConnector(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'unix:///var/run/docker.sock',
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new UnixConnector($loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$client = new Client($loop, $connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$request = $client->request('GET', 'http://localhost/info');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also example #11.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new FixedUriConnector(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'unix:///var/run/docker.sock',
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    new UnixConnector($loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$client = new Client($loop, $connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$request = $client->request('GET', 'http://localhost/info');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also example #11.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $ composer require react/http-client:^0.5.10
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $ composer require react/http-client:^0.5.9

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. It's highly recommended to use PHP 7+ for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                              To run the test suite, you first need to clone this repo and then install all dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              $ composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -411,17 +373,18 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HttpClient

                                                                                                                                                                                                                                                                                                                                                                                                                                                              on a stable internet connection. If you do not want to run these, they can simply be skipped like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              $ php vendor/bin/phpunit --exclude-group internet
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              License

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +License

                                                                                                                                                                                                                                                                                                                                                                                                                                                              MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -217,7 +199,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HttpClient License

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTPClient License

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Copyright (c) 2012 Igor Wiedler, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Permission is hereby granted, free of charge, to any person obtaining a copy @@ -239,11 +221,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HttpClient License

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -221,12 +203,6 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - 2024 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.11.0 - - - (2024-11-20) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Improve PHP 8.4+ support by avoiding implicitly nullable types.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#537 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Allow underscore character in Uri host.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#524 by @lulhum)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite to fix expected error code when ext-sockets is not enabled.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#539 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.10.0 - - - (2024-03-27) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Add new PSR-7 implementation and remove dated RingCentral PSR-7 dependency.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#518, #519, #520 and #522 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This changeset allows us to maintain our own PSR-7 implementation and reduce
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -dependencies on external projects. It also improves performance slightly and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -does not otherwise affect our public API. If you want to explicitly install
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -the old RingCentral PSR-7 dependency, you can still install it like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                composer require ringcentral/psr7
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Add new Uri class for new PSR-7 implementation.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#521 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Validate outgoing HTTP message headers and reject invalid messages.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#523 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Full PHP 8.3 compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#508 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Fix HTTP client to omit Transfer-Encoding: chunked when streaming empty request body.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#516 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Ensure connection close handler is cleaned up for each request.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#515 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Update test suite and avoid unhandled promise rejections.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#501 and #502 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - 2023 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.9.0 - - - (2023-04-26) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This is a SECURITY and feature release for the 1.x series of ReactPHP's HTTP component.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Security fix: This release fixes a medium severity security issue in ReactPHP's HTTP server component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -that affects all versions between v0.8.0 and v1.8.0. All users are encouraged to upgrade immediately.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(CVE-2023-26044 reported and fixed by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Support HTTP keep-alive for HTTP client (reusing persistent connections).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#481, #484, #486 and #495 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This feature offers significant performance improvements when sending many
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -requests to the same host as it avoids recreating the underlying TCP/IP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -connection and repeating the TLS handshake for secure HTTPS requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = new React\Http\Browser();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// Up to 300% faster! HTTP keep-alive is enabled by default
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$response = React\Async\await($browser->get('https://httpbingo.org/redirect/6'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -assert($response instanceof Psr\Http\Message\ResponseInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Add Request class to represent outgoing HTTP request message.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#480 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Preserve request method and body for 307 Temporary Redirect and 308 Permanent Redirect.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#442 by @dinooo13)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Include buffer logic to avoid dependency on reactphp/promise-stream.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#482 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite and project setup and report failed assertions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#478 by @clue, #487 and #491 by @WyriHaximus and #475 and #479 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - 2022 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.8.0 - - - (2022-09-29) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Support for default request headers.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#461 by @51imyy)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = new React\Http\Browser();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = $browser->withHeader('User-Agent', 'ACME');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Forward compatibility with upcoming Promise v3.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#460 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.7.0 - - - (2022-08-23) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This is a SECURITY and feature release for the 1.x series of ReactPHP's HTTP component.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Security fix: This release fixes a medium severity security issue in ReactPHP's HTTP server component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -that affects all versions between v0.7.0 and v1.6.0. All users are encouraged to upgrade immediately.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Special thanks to Marco Squarcina (TU Wien) for reporting this and working with us to coordinate this release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(CVE-2022-36032 reported by @lavish and fixed by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Improve HTTP server performance by ~20%, reuse syscall values for clock time and socket addresses.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#457 and #467 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Full PHP 8.2+ compatibility, refactor internal Transaction to avoid assigning dynamic properties.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#459 by @clue and #466 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / Fix: Allow explicit Content-Length response header on HEAD requests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#444 by @mrsimonbennett)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#452 by @clue, #458 by @nhedger, #448 by @jorrit and #446 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite, update to use new reactphp/async package instead of clue/reactphp-block,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -skip memory tests when lowering memory limit fails and fix legacy HHVM build.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#464 and #440 by @clue and #450 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.6.0 - - - (2022-02-03) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Add factory methods for common HTML/JSON/plaintext/XML response types.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#439 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = React\Http\Response\html("<h1>Hello wörld!</h1>\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$response = React\Http\Response\json(['message' => 'Hello wörld!']);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$response = React\Http\Response\plaintext("Hello wörld!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$response = React\Http\Response\xml("<message>Hello wörld!</message>\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Expose all status code constants via Response class.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#432 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    React\Http\Message\Response::STATUS_OK, // 200 OK
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    …
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$response = new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    React\Http\Message\Response::STATUS_NOT_FOUND, // 404 Not Found
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    …
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Full support for PHP 8.1 release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#433 by @SimonFrings and #434 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / Fix: Improve protocol handling for HTTP responses with no body.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#429 and #430 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internal refactoring and internal improvements for handling requests and responses.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#422 by @WyriHaximus and #431 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve documentation, update proxy examples, include error reporting in examples.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#420, #424, #426, and #427 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Update test suite to use default loop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#438 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - 2021 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.5.0 - - - (2021-08-04) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Update Browser signature to take optional $connector as first argument and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -to match new Socket API without nullable loop arguments.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#418 and #419 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // unchanged
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser(null, $connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($loop, $connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($connector, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Rename Server to HttpServer to avoid class name collisions and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -to avoid any ambiguities with regards to the new SocketServer API.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#417 and #419 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Http\Server($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server->listen(new React\Socket\Server(8080));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$http = new React\Http\HttpServer($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$http->listen(new React\Socket\SocketServer('127.0.0.1:8080'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.4.0 - - - (2021-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Simplify usage by supporting new default loop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#410 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // old (still supported)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Http\Server($loop, $handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// new (using default loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Http\Server($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.3.0 - - - (2021-04-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Support persistent connections (Connection: keep-alive).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#405 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This shows a noticeable performance improvement especially when benchmarking
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -using persistent connections (which is the default pretty much everywhere).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Together with other changes in this release, this improves benchmarking
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -performance by around 100%.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Require Host request header for HTTP/1.1 requests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#404 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#398 by @fritz-gerneth and #399 and #400 by @pavog)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite, use GitHub actions for continuous integration (CI).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#402 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - 2020 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.2.0 - - - (2020-12-04) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Keep request body in memory also after consuming request body.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#395 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This means consumers can now always access the complete request body as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -detailed in the documentation. This allows building custom parsers and more
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -advanced processing models without having to mess with the default parsers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.1.0 - - - (2020-09-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Support upcoming PHP 8 release, update to reactphp/socket v1.6 and adjust type checks for invalid chunk headers.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#391 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Consistently resolve base URL according to HTTP specs.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#379 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / Fix: Expose Transfer-Encoding: chunked response header and fix chunked responses for HEAD requests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#381 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internal refactoring to remove unneeded MessageFactory and Response classes.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#380 and #389 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Minor documentation improvements and improve test suite, update to support PHPUnit 9.3.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#385 by @clue and #393 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.0.0 - - - (2020-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • First stable LTS release, now following SemVer.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -We'd like to emphasize that this component is production ready and battle-tested.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -We plan to support all long-term support (LTS) releases for at least 24 months,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -so you have a rock-solid foundation to build on top of.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This update involves some major new features and a number of BC breaks due to
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -some necessary API cleanup. We've tried hard to avoid BC breaks where possible
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -and minimize impact otherwise. We expect that most consumers of this package
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -will be affected by BC breaks, but updating should take no longer than a few
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -minutes. See below for more details:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Add async HTTP client implementation.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#368 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = new React\Http\Browser($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo $response->getBody();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The code has been imported as-is from clue/reactphp-buzz v2.9.0,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -with only minor changes to the namespace and we otherwise leave all the existing APIs unchanged.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Upgrading from clue/reactphp-buzz v2.9.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -to this release should be a matter of updating some namespace references only:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new Clue\React\Buzz\Browser($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: Add LoopInterface as required first constructor argument to Server and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -change Server to accept variadic middleware handlers instead of array.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#361 and #362 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Http\Server($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Http\Server([$middleware, $handler]);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Http\Server($loop, $handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Http\Server($loop, $middleware, $handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: Move Response class to React\Http\Message\Response and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -expose ServerRequest class to React\Http\Message\ServerRequest.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#370 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$response = new React\Http\Response(200, [], 'Hello!');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$response = new React\Http\Message\Response(200, [], 'Hello!');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: Add StreamingRequestMiddleware to stream incoming requests, mark StreamingServer as internal.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#367 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // old: advanced StreamingServer is now internal only
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Http\StreamingServer($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// new: use StreamingRequestMiddleware instead of StreamingServer
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Http\Server(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -     $loop,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -     new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -     $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: Improve default concurrency to 1024 requests and cap default request buffer at 64K.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#371 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This improves default concurrency to 1024 requests and caps the default request buffer at 64K.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -The previous defaults resulted in just 4 concurrent requests with a request buffer of 8M.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -See Server for details on how to override these defaults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Expose ReactPHP in User-Agent client-side request header and in Server server-side response header.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#374 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Mark all classes as final to discourage inheriting from it.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#373 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve documentation and use fully-qualified class names throughout the documentation and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -add ReactPHP core team as authors to composer.json and license file.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#366 and #369 by @WyriHaximus and #375 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite and support skipping all online tests with --exclude-group internet.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#372 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 0.8.7 - - - (2020-07-05) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Fix parsing multipart request body with quoted header parameters (dot net).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#363 by @ebimmel)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Fix calculating concurrency when post_max_size ini is unlimited.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#365 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite to run tests on PHPUnit 9 and clean up test suite.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#364 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 0.8.6 - - - (2020-01-12) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Fix parsing Cookie request header with comma in its values.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#352 by @Fiskie)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Avoid unneeded warning when decoding invalid data on PHP 7.4.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#357 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Add .gitattributes to exclude dev files from exports.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#353 by @reedy)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - 2019 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 0.8.5 - - - (2019-10-29) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internal refactorings and optimizations to improve request parsing performance.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Benchmarks suggest number of requests/s improved by ~30% for common GET requests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#345, #346, #349 and #350 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Add documentation and example for JSON/XML request body and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -improve documentation for concurrency and streaming requests and for error handling.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#341 and #342 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 0.8.4 - - - (2019-01-16) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improvement: Internal refactoring to simplify response header logic.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#321 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improvement: Assign Content-Length response header automatically only when size is known.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#329 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improvement: Import global functions for better performance.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#330 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              2018

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -952,22 +231,22 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Do not pause connection stream to detect closed connections immediately.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#315 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Do not pause connection stream to detect closed connections immediately.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#315 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Keep incoming Transfer-Encoding: chunked request header.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#316 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Keep incoming Transfer-Encoding: chunked request header.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#316 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Reject invalid requests that contain both Content-Length and Transfer-Encoding request headers.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#318 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Reject invalid requests that contain both Content-Length and Transfer-Encoding request headers.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#318 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Minor internal refactoring to simplify connection close logic after sending response.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#317 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Minor internal refactoring to simplify connection close logic after sending response.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#317 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -986,26 +265,26 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Do not pass $next handler to final request handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#308 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Do not pass $next handler to final request handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#308 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Fix awaiting queued handlers when cancelling a queued handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#313 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Fix awaiting queued handlers when cancelling a queued handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#313 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Fix Server to skip SERVER_ADDR params for Unix domain sockets (UDS).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#307 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Fix Server to skip SERVER_ADDR params for Unix domain sockets (UDS).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#307 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Documentation for PSR-15 middleware and minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#314 by @clue and #297, #298 and #310 by @seregazhuk)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Documentation for PSR-15 middleware and minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#314 by @clue and #297, #298 and #310 by @seregazhuk)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Minor code improvements and micro optimizations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#301 by @seregazhuk and #305 by @kalessil)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Minor code improvements and micro optimizations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#301 by @seregazhuk and #305 by @kalessil)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1024,26 +303,26 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Major request handler performance improvement. Benchmarks suggest number of
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -requests/s improved by more than 50% for common GET requests!
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Major request handler performance improvement. Benchmarks suggest number of
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +requests/s improved by more than 50% for common GET requests!
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      We now avoid queuing, buffering and wrapping incoming requests in promises
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      when we're below limits and instead can directly process common requests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#291, #292, #293, #294 and #296 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#291, #292, #293, #294 and #296 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Fix: Fix concurrent invoking next middleware request handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#293 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Fix: Fix concurrent invoking next middleware request handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#293 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Small code improvements
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#286 by @seregazhuk)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Small code improvements
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#286 by @seregazhuk)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite to be less fragile when using ext-event and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite to be less fragile when using ext-event and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      fix test suite forward compatibility with upcoming EventLoop releases
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#288 and #290 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#288 and #290 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1067,102 +346,102 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature / BC break: Add new Server facade that buffers and parses incoming
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature / BC break: Add new Server facade that buffers and parses incoming
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        HTTP requests. This provides full PSR-7 compatibility, including support for
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        form submissions with POST fields and file uploads.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -The old Server has been renamed to StreamingServer for advanced usage
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +The old Server has been renamed to StreamingServer for advanced usage
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        and is used internally.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#266, #271, #281, #282, #283 and #284 by @WyriHaximus and @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // old: handle incomplete/streaming requests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server = new Server($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -// new: handle complete, buffered and parsed requests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -// new: full PSR-7 support, including POST fields and file uploads
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server = new Server($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -// new: handle incomplete/streaming requests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server = new StreamingServer($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#266, #271, #281, #282, #283 and #284 by @WyriHaximus and @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // old: handle incomplete/streaming requests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +$server = new Server($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +// new: handle complete, buffered and parsed requests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +// new: full PSR-7 support, including POST fields and file uploads
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +$server = new Server($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +// new: handle incomplete/streaming requests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +$server = new StreamingServer($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        While this is technically a small BC break, this should in fact not break
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        While this is technically a small BC break, this should in fact not break
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        most consuming code. If you rely on the old request streaming, you can
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -explicitly use the advanced StreamingServer to restore old behavior.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +explicitly use the advanced StreamingServer to restore old behavior.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Add support for middleware request handler arrays
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#215, #228, #229, #236, #237, #238, #246, #247, #277, #279 and #285 by @WyriHaximus, @clue and @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // new: middleware request handler arrays
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server = new Server(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    function (ServerRequestInterface $request, callable $next) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -        $request = $request->withHeader('Processed', time());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -        return $next($request);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -        return new Response();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Add support for limiting how many next request handlers can be
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -executed concurrently (LimitConcurrentRequestsMiddleware)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#272 by @clue and @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // new: explicitly limit concurrency
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server = new Server(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    new LimitConcurrentRequestsMiddleware(10),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Add support for buffering the incoming request body
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(RequestBodyBufferMiddleware).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -This feature mimics PHP's default behavior and respects its post_max_size
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Add support for middleware request handler arrays
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#215, #228, #229, #236, #237, #238, #246, #247, #277, #279 and #285 by @WyriHaximus, @clue and @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // new: middleware request handler arrays
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +$server = new Server(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    function (ServerRequestInterface $request, callable $next) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +        $request = $request->withHeader('Processed', time());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +        return $next($request);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +        return new Response();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Add support for limiting how many next request handlers can be
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +executed concurrently (LimitConcurrentRequestsMiddleware)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#272 by @clue and @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // new: explicitly limit concurrency
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +$server = new Server(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    new LimitConcurrentRequestsMiddleware(10),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Add support for buffering the incoming request body
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(RequestBodyBufferMiddleware).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +This feature mimics PHP's default behavior and respects its post_max_size
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ini setting by default and allows explicit configuration.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#216, #224, #263, #276 and #278 by @WyriHaximus and #235 by @andig)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // new: buffer up to 10 requests with 8 MiB each
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server = new StreamingServer(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    new LimitConcurrentRequestsMiddleware(10),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    new RequestBodyBufferMiddleware('8M'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#216, #224, #263, #276 and #278 by @WyriHaximus and #235 by @andig)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // new: buffer up to 10 requests with 8 MiB each
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +$server = new StreamingServer(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    new LimitConcurrentRequestsMiddleware(10),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    new RequestBodyBufferMiddleware('8M'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Add support for parsing form submissions with POST fields and file
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -uploads (RequestBodyParserMiddleware).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Add support for parsing form submissions with POST fields and file
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +uploads (RequestBodyParserMiddleware).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        This feature mimics PHP's default behavior and respects its ini settings and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -MAX_FILE_SIZE POST fields by default and allows explicit configuration.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#220, #226, #252, #261, #264, #265, #267, #268, #274 by @WyriHaximus and @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // new: buffer up to 10 requests with 8 MiB each
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -// and limit to 4 uploads with 2 MiB each
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server = new StreamingServer(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    new LimitConcurrentRequestsMiddleware(10),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    new RequestBodyBufferMiddleware('8M'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    new RequestBodyParserMiddleware('2M', 4)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +MAX_FILE_SIZE POST fields by default and allows explicit configuration.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#220, #226, #252, #261, #264, #265, #267, #268, #274 by @WyriHaximus and @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // new: buffer up to 10 requests with 8 MiB each
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +// and limit to 4 uploads with 2 MiB each
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +$server = new StreamingServer(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    new LimitConcurrentRequestsMiddleware(10),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    new RequestBodyBufferMiddleware('8M'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    new RequestBodyParserMiddleware('2M', 4)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Update Socket to work around sending secure HTTPS responses with PHP < 7.1.4
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#244 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Update Socket to work around sending secure HTTPS responses with PHP < 7.1.4
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#244 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Support sending same response header multiple times (e.g. Set-Cookie)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#248 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Support sending same response header multiple times (e.g. Set-Cookie)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#248 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Raise maximum request header size to 8k to match common implementations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#253 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Raise maximum request header size to 8k to match common implementations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#253 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Improve test suite by adding forward compatibility with PHPUnit 6, test
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Improve test suite by adding forward compatibility with PHPUnit 6, test
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        against PHP 7.1 and PHP 7.2 and refactor and remove risky and duplicate tests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#243, #269 and #270 by @carusogabriel and #249 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#243, #269 and #270 by @carusogabriel and #249 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Minor code refactoring to move internal classes to React\Http\Io namespace
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Minor code refactoring to move internal classes to React\Http\Io namespace
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        and clean up minor code and documentation issues
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#251 by @clue, #227 by @kalessil, #240 by @christoph-kluge, #230 by @jsor and #280 by @andig)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#251 by @clue, #227 by @kalessil, #240 by @christoph-kluge, #230 by @jsor and #280 by @andig)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1181,9 +460,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1201,19 +480,19 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support Throwable when setting previous exception from server callback
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#155 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support Throwable when setting previous exception from server callback
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#155 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fixed URI parsing for origin-form requests that contain scheme separator
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -such as /path?param=http://example.com.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#209 by @aaronbonneau)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fixed URI parsing for origin-form requests that contain scheme separator
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +such as /path?param=http://example.com.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#209 by @aaronbonneau)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite by locking Travis distro so new defaults will not break the build
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#211 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite by locking Travis distro so new defaults will not break the build
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#211 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1232,14 +511,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Fix: Stricter check for invalid request-line in HTTP requests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#206 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Fix: Stricter check for invalid request-line in HTTP requests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#206 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Refactor to use HTTP response reason phrases from response object
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#205 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Refactor to use HTTP response reason phrases from response object
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#205 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1258,14 +537,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Fix parsing CONNECT request without Host header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#201 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Fix parsing CONNECT request without Host header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#201 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internal preparation for future PSR-7 UploadedFileInterface
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#199 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internal preparation for future PSR-7 UploadedFileInterface
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#199 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1284,79 +563,79 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: Use PSR-7 (http-message) standard and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Request-In-Response-Out-style request handler callback.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Pass standard PSR-7 ServerRequestInterface and expect any standard
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -PSR-7 ResponseInterface in return for the request handler callback.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#146 and #152 and #170 by @legionth)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$app = function (Request $request, Response $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $response->end("Hello world!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$app = function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        array('Content-Type' => 'text/plain'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        "Hello world!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                A Content-Length header will automatically be included if the size can be
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / BC break: Use PSR-7 (http-message) standard and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Request-In-Response-Out-style request handler callback.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Pass standard PSR-7 ServerRequestInterface and expect any standard
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +PSR-7 ResponseInterface in return for the request handler callback.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#146 and #152 and #170 by @legionth)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$app = function (Request $request, Response $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    $response->end("Hello world!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$app = function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        array('Content-Type' => 'text/plain'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        "Hello world!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  A Content-Length header will automatically be included if the size can be
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  determined from the response body.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#164 by @maciejmrozinski)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The request handler callback will automatically make sure that responses to
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -HEAD requests and certain status codes, such as 204 (No Content), never
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#164 by @maciejmrozinski)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The request handler callback will automatically make sure that responses to
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +HEAD requests and certain status codes, such as 204 (No Content), never
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  contain a response body.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#156 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The intermediary 100 Continue response will automatically be sent if
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#156 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The intermediary 100 Continue response will automatically be sent if
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  demanded by a HTTP/1.1 client.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#144 by @legionth)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The request handler callback can now return a standard Promise if
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#144 by @legionth)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The request handler callback can now return a standard Promise if
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  processing the request needs some time, such as when querying a database.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Similarly, the request handler may return a streaming response if the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -response body comes from a ReadableStreamInterface or its size is
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +response body comes from a ReadableStreamInterface or its size is
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  unknown in advance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$app = function (Request $request, Response $response) use ($db) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $db->query()->then(function ($result) use ($response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        $response->end($result);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$app = function (ServerRequestInterface $request) use ($db) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    return $db->query()->then(function ($result) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -            200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -            array('Content-Type' => 'text/plain'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -            $result
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Pending promies and response streams will automatically be canceled once the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$app = function (Request $request, Response $response) use ($db) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    $db->query()->then(function ($result) use ($response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        $response->end($result);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$app = function (ServerRequestInterface $request) use ($db) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    return $db->query()->then(function ($result) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +            200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +            array('Content-Type' => 'text/plain'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +            $result
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Pending promies and response streams will automatically be canceled once the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  client connection closes.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#187 and #188 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The ServerRequestInterface contains the full effective request URI,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#187 and #188 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The ServerRequestInterface contains the full effective request URI,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  server-side parameters, query parameters and parsed cookies values as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  defined in PSR-7.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#167 by @clue and #174, #175 and #180 by @legionth)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $app = function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        array('Content-Type' => 'text/plain'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        $request->getUri()->getScheme()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Advanced: Support duplex stream response for Upgrade requests such as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Upgrade: WebSocket or custom protocols and CONNECT requests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#189 and #190 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#167 by @clue and #174, #175 and #180 by @legionth)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  $app = function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        array('Content-Type' => 'text/plain'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        $request->getUri()->getScheme()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Advanced: Support duplex stream response for Upgrade requests such as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Upgrade: WebSocket or custom protocols and CONNECT requests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#189 and #190 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Note that the request body will currently not be buffered and parsed by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Note that the request body will currently not be buffered and parsed by
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  default, which depending on your particilar use-case, may limit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  interoperability with the PSR-7 (http-message) ecosystem.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The provided streaming request body interfaces allow you to perform
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1365,39 +644,39 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / BC break: Replace request listener with callback function and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -use listen() method to support multiple listening sockets
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#97 by @legionth and #193 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$server = new Server($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$server->on('request', $app);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$server = new Server($app);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$server->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / BC break: Replace request listener with callback function and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +use listen() method to support multiple listening sockets
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#97 by @legionth and #193 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$server = new Server($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$server->on('request', $app);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$server = new Server($app);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$server->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support the more advanced HTTP requests, such as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -OPTIONS * HTTP/1.1 (OPTIONS method in asterisk-form),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -GET http://example.com/path HTTP/1.1 (plain proxy requests in absolute-form),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -CONNECT example.com:443 HTTP/1.1 (CONNECT proxy requests in authority-form)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -and sanitize Host header value across all requests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#157, #158, #161, #165, #169 and #173 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support the more advanced HTTP requests, such as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +OPTIONS * HTTP/1.1 (OPTIONS method in asterisk-form),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +GET http://example.com/path HTTP/1.1 (plain proxy requests in absolute-form),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +CONNECT example.com:443 HTTP/1.1 (CONNECT proxy requests in authority-form)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +and sanitize Host header value across all requests.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#157, #158, #161, #165, #169 and #173 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Forward compatibility with Socket v1.0, v0.8, v0.7 and v0.6 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Forward compatibility with Socket v1.0, v0.8, v0.7 and v0.6 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  forward compatibility with Stream v1.0 and v0.7
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#154, #163, #183, #184 and #191 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#154, #163, #183, #184 and #191 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Simplify examples to ease getting started and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Simplify examples to ease getting started and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  add benchmarking example
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#151 and #162 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#151 and #162 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite by adding tests for case insensitive chunked transfer
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite by adding tests for case insensitive chunked transfer
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  encoding and ignoring HHVM test failures until Travis tests work again.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#150 by @legionth and #185 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#150 by @legionth and #185 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1416,55 +695,55 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature / BC break: The Request and Response objects now follow strict
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature / BC break: The Request and Response objects now follow strict
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    stream semantics and their respective methods and events.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#116, #129, #133, #135, #136, #137, #138, #140, #141 by @legionth
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -and #122, #123, #130, #131, #132, #142 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This implies that the Server now supports proper detection of the request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#116, #129, #133, #135, #136, #137, #138, #140, #141 by @legionth
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +and #122, #123, #130, #131, #132, #142 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This implies that the Server now supports proper detection of the request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    message body stream, such as supporting decoding chunked transfer encoding,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -delimiting requests with an explicit Content-Length header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +delimiting requests with an explicit Content-Length header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    and those with an empty request message body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    These streaming semantics are compatible with previous Stream v0.5, future
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    These streaming semantics are compatible with previous Stream v0.5, future
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    compatible with v0.5 and upcoming v0.6 versions and can be used like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    $http->on('request', function (Request $request, Response $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    $contentLength = 0;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    $request->on('data', function ($data) use (&$contentLength) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -        $contentLength += strlen($data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    $request->on('end', function () use ($response, &$contentLength){
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -        $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -        $response->end("The length of the submitted request body is: " . $contentLength);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    // an error occured
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    // e.g. on invalid chunked encoded data or an unexpected 'end' event 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    $request->on('error', function (\Exception $exception) use ($response, &$contentLength) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -        $response->writeHead(400, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -        $response->end("An error occured while reading at length: " . $contentLength);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Similarly, the Request and Response now strictly follow the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -close() method and close event semantics.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -Closing the Request does not interrupt the underlying TCP/IP in
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    $http->on('request', function (Request $request, Response $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    $contentLength = 0;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    $request->on('data', function ($data) use (&$contentLength) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +        $contentLength += strlen($data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    $request->on('end', function () use ($response, &$contentLength){
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +        $response->writeHead(200, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +        $response->end("The length of the submitted request body is: " . $contentLength);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    // an error occured
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    // e.g. on invalid chunked encoded data or an unexpected 'end' event 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    $request->on('error', function (\Exception $exception) use ($response, &$contentLength) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +        $response->writeHead(400, array('Content-Type' => 'text/plain'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +        $response->end("An error occured while reading at length: " . $contentLength);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Similarly, the Request and Response now strictly follow the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +close() method and close event semantics.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +Closing the Request does not interrupt the underlying TCP/IP in
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    order to allow still sending back a valid response message.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -Closing the Response does terminate the underlying TCP/IP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +Closing the Response does terminate the underlying TCP/IP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    connection in order to clean up resources.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    You should make sure to always attach a request event listener
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -like above. The Server will not respond to an incoming HTTP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    You should make sure to always attach a request event listener
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +like above. The Server will not respond to an incoming HTTP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    request otherwise and keep the TCP/IP connection pending until the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    other side chooses to close the connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Support HTTP/1.1 and HTTP/1.0 for Request and Response.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#124, #125, #126, #127, #128 by @clue and #139 by @legionth)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    The outgoing Response will automatically use the same HTTP version as the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -incoming Request message and will only apply HTTP/1.1 semantics if
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -applicable. This includes that the Response will automatically attach a
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -Date and Connection: close header if applicable.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This implies that the Server now automatically responds with HTTP error
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Support HTTP/1.1 and HTTP/1.0 for Request and Response.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#124, #125, #126, #127, #128 by @clue and #139 by @legionth)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    The outgoing Response will automatically use the same HTTP version as the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +incoming Request message and will only apply HTTP/1.1 semantics if
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +applicable. This includes that the Response will automatically attach a
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +Date and Connection: close header if applicable.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This implies that the Server now automatically responds with HTTP error
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    messages for invalid requests (status 400) and those exceeding internal
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    request header limits (status 431).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • @@ -1485,41 +764,41 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature / BC break: Change Request methods to be in line with PSR-7
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#117 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Rename getQuery() to getQueryParams()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Rename getHttpVersion() to getProtocolVersion()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Change getHeaders() to always return an array of string values
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: Change Request methods to be in line with PSR-7
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#117 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Rename getQuery() to getQueryParams()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Rename getHttpVersion() to getProtocolVersion()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Change getHeaders() to always return an array of string values
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            for each header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: Update Socket component to v0.5 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: Update Socket component to v0.5 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          add secure HTTPS server support
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#90 and #119 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old plaintext HTTP server
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$socket = new React\Socket\Server($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$socket->listen(8080, '127.0.0.1');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$http = new React\Http\Server($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -// new plaintext HTTP server
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$http = new React\Http\Server($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -// new secure HTTPS server
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$socket = new React\Socket\SecureServer($socket, $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    'local_cert' => __DIR__ . '/localhost.pem'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$http = new React\Http\Server($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          BC break: Mark internal APIs as internal or private and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -remove unneeded ServerInterface
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#118 by @clue, #95 by @legionth)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#90 and #119 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old plaintext HTTP server
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$socket = new React\Socket\Server($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$socket->listen(8080, '127.0.0.1');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$http = new React\Http\Server($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +// new plaintext HTTP server
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$http = new React\Http\Server($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +// new secure HTTPS server
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$socket = new React\Socket\SecureServer($socket, $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    'local_cert' => __DIR__ . '/localhost.pem'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$http = new React\Http\Server($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          BC break: Mark internal APIs as internal or private and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +remove unneeded ServerInterface
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#118 by @clue, #95 by @legionth)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1538,45 +817,45 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Add request header accessors (à la PSR-7)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#103 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // get value of host header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$host = $request->getHeaderLine('Host');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// get list of all cookie headers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$cookies = $request->getHeader('Cookie');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Add request header accessors (à la PSR-7)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#103 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // get value of host header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$host = $request->getHeaderLine('Host');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// get list of all cookie headers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$cookies = $request->getHeader('Cookie');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Forward pause() and resume() from Request to underlying connection
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#110 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // support back-pressure when piping request into slower destination
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$request->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// manually pause/resume request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$request->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$request->resume();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Forward pause() and resume() from Request to underlying connection
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#110 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // support back-pressure when piping request into slower destination
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$request->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// manually pause/resume request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$request->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$request->resume();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fix 100-continue to be handled case-insensitive and ignore it for HTTP/1.0.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fix 100-continue to be handled case-insensitive and ignore it for HTTP/1.0.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Similarly, outgoing response headers are now handled case-insensitive, e.g
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -we no longer apply chunked transfer encoding with mixed-case Content-Length.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#107 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // now handled case-insensitive
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$request->expectsContinue();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// now works just like properly-cased header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$response->writeHead($status, array('content-length' => 0));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +we no longer apply chunked transfer encoding with mixed-case Content-Length.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#107 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            // now handled case-insensitive
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$request->expectsContinue();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +// now works just like properly-cased header
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$response->writeHead($status, array('content-length' => 0));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Do not emit empty data events and ignore empty writes in order to
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Do not emit empty data events and ignore empty writes in order to
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            not mess up chunked transfer encoding
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#108 and #112 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#108 and #112 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Lock and test minimum required dependency versions and support PHPUnit v5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#113, #115 and #114 by @andig)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Lock and test minimum required dependency versions and support PHPUnit v5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#113, #115 and #114 by @andig)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1595,17 +874,17 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1628,12 +907,12 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Remove all listeners after emitting error in RequestHeaderParser #68 @WyriHaximus
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Catch Guzzle parse request errors #65 @WyriHaximus
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Remove branch-alias definition as per reactphp/reactphp#343 #58 @WyriHaximus
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Add functional example to ease getting started #64 by @clue
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Naming, immutable array manipulation #37 @cboden
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1656,10 +935,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Replaced guzzle/parser with guzzlehttp/psr7 by @cboden
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • FIX Continue Header by @iannsp
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Missing type hint by @marenzo
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Replaced guzzle/parser with guzzlehttp/psr7 by @cboden
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • FIX Continue Header by @iannsp
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Missing type hint by @marenzo

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1682,7 +961,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • BC break: Update to Evenement 2.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • @@ -1710,7 +989,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bump React dependencies to v0.3
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1734,8 +1013,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: Emit end event when Response closes (@beaucollins)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Emit end event when Response closes (@beaucollins)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1753,9 +1032,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Forward drain events from HTTP response (@cs278)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Dependency: Updated guzzle deps to 3.0.*
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bug fix: Forward drain events from HTTP response (@cs278)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Dependency: Updated guzzle deps to 3.0.*

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1773,7 +1052,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1792,7 +1071,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: Support HTTP 1.1 continue
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1811,7 +1090,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bump React dependencies to v0.2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1830,7 +1109,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1849,7 +1128,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1870,8 +1149,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    HTTP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    diff --git a/http/index.html b/http/index.html index ad2b268d0..c16848526 100644 --- a/http/index.html +++ b/http/index.html @@ -5,9 +5,10 @@ - HTTP - ReactPHP + HTTP: +Http - ReactPHP - + @@ -20,13 +21,13 @@ - - + + - - - + + + @@ -40,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -219,63 +202,32 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              CI status -installs on Packagist

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Event-driven, streaming HTTP client and server implementation for ReactPHP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This HTTP library provides re-usable implementations for an HTTP client and -server based on ReactPHP's Socket and -EventLoop components. -Its client component allows you to send any number of async HTTP/HTTPS requests -concurrently. -Its server component allows you to build plaintext HTTP and secure HTTPS servers -that accept incoming HTTP requests from HTTP clients (such as web browsers). -This library provides async, streaming means for all of this, so you can handle -multiple concurrent HTTP requests without blocking.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Table of contents

                                                                                                                                                                                                                                                                                                                                                                                                                                                              + +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Build Status

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Event-driven, streaming plaintext HTTP and secure HTTPS server for ReactPHP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Table of Contents

                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Quickstart example
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -Client Usage - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -Server Usage +Usage -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Quickstart example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Once installed, you can use the following code to access an -HTTP web server and send some simple HTTP GET requests:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?php
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -require __DIR__ . '/vendor/autoload.php';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$client = new React\Http\Browser();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$client->get('http://www.google.com/')->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getHeaders(), (string)$response->getBody());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Quickstart example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is an HTTP server which responds with Hello World! to every request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?php
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -require __DIR__ . '/vendor/autoload.php';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        "Hello World!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$socket = new React\Socket\SocketServer('127.0.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$http->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Client Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Request methods

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Most importantly, this project provides a Browser object that -offers several methods that resemble the HTTP protocol methods:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->get($url, array $headers = array());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->head($url, array $headers = array());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->post($url, array $headers = array(), string|ReadableStreamInterface $body = '');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->delete($url, array $headers = array(), string|ReadableStreamInterface $body = '');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->put($url, array $headers = array(), string|ReadableStreamInterface $body = '');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->patch($url, array $headers = array(), string|ReadableStreamInterface $body = '');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Each of these methods requires a $url and some optional parameters to send an -HTTP request. Each of these method names matches the respective HTTP request -method, for example the get() method sends an HTTP GET request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can optionally pass an associative array of additional $headers that will be -sent with this HTTP request. Additionally, each method will automatically add a -matching Content-Length request header if an outgoing request body is given and its -size is known and non-empty. For an empty request body, if will only include a -Content-Length: 0 request header if the request method usually expects a request -body (only applies to POST, PUT and PATCH HTTP request methods).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you're using a streaming request body, it will default -to using Transfer-Encoding: chunked unless you explicitly pass in a matching Content-Length -request header. See also streaming request for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, all of the above methods default to sending requests using the -HTTP/1.1 protocol version. If you want to explicitly use the legacy HTTP/1.0 -protocol version, you can use the withProtocolVersion() -method. If you want to use any other or even custom HTTP request method, you can -use the request() method.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Each of the above methods supports async operation and either fulfills with a -PSR-7 ResponseInterface -or rejects with an Exception. -Please see the following chapter about promises for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Promises

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Sending requests is async (non-blocking), so you can actually send multiple -requests in parallel. -The Browser will respond to each request with a -PSR-7 ResponseInterface -message, the order is not guaranteed. -Sending requests uses a Promise-based -interface that makes it easy to react to when an HTTP request is completed -(i.e. either successfully fulfilled or rejected with an error):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->get($url)->then(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        var_dump('Response received', $response);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If this looks strange to you, you can also use the more traditional blocking API.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Keep in mind that resolving the Promise with the full response message means the -whole response body has to be kept in memory. -This is easy to get started and works reasonably well for smaller responses -(such as common HTML pages or RESTful or JSON API requests).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You may also want to look into the streaming API:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If you're dealing with lots of concurrent requests (100+) or
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If you want to process individual data chunks as they happen (without having to wait for the full response body) or
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If you're expecting a big response body size (1 MiB or more, for example when downloading binary files) or
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If you're unsure about the response body size (better be safe than sorry when accessing arbitrary remote HTTP endpoints and the response body size is unknown in advance).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Cancellation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The returned Promise is implemented in such a way that it can be cancelled -when it is still pending. -Cancelling a pending promise will reject its value with an Exception and -clean up any underlying resources.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = $browser->get($url);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(2.0, function () use ($promise) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Timeouts

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This library uses a very efficient HTTP implementation, so most HTTP requests -should usually be completed in mere milliseconds. However, when sending HTTP -requests over an unreliable network (the internet), there are a number of things -that can go wrong and may cause the request to fail after a time. As such, this -library respects PHP's default_socket_timeout setting (default 60s) as a timeout -for sending the outgoing HTTP request and waiting for a successful response and -will otherwise cancel the pending request and reject its value with an Exception.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that this timeout value covers creating the underlying transport connection, -sending the HTTP request, receiving the HTTP response headers and its full -response body and following any eventual redirects. See also -redirects below to configure the number of redirects to follow (or -disable following redirects altogether) and also streaming -below to not take receiving large response bodies into account for this timeout.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can use the withTimeout() method to pass a custom timeout -value in seconds like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withTimeout(10.0);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // response received within 10 seconds maximum
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getHeaders());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Similarly, you can use a bool false to not apply a timeout at all -or use a bool true value to restore the default handling. -See withTimeout() for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you're using a streaming response body, the time it -takes to receive the response body stream will not be included in the timeout. -This allows you to keep this incoming stream open for a longer time, such as -when downloading a very large stream or when streaming data over a long-lived -connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you're using a streaming request body, the time it -takes to send the request body stream will not be included in the timeout. This -allows you to keep this outgoing stream open for a longer time, such as when -uploading a very large stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that this timeout handling applies to the higher-level HTTP layer. Lower -layers such as socket and DNS may also apply (different) timeout values. In -particular, the underlying socket connection uses the same default_socket_timeout -setting to establish the underlying transport connection. To control this -connection timeout behavior, you can inject a custom Connector -like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = new React\Http\Browser(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Socket\Connector(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            'timeout' => 5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        )
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Authentication

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This library supports HTTP Basic Authentication -using the Authorization: Basic … request header or allows you to set an explicit -Authorization request header.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, this library does not include an outgoing Authorization request -header. If the server requires authentication, if may return a 401 (Unauthorized) -status code which will reject the request by default (see also the -withRejectErrorResponse() method below).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to pass authentication details, you can simply pass the username and -password as part of the request URL like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = $browser->get('https://user:pass@example.com/api');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that special characters in the authentication details have to be -percent-encoded, see also rawurlencode(). -This example will automatically pass the base64-encoded authentication details -using the outgoing Authorization: Basic … request header. If the HTTP endpoint -you're talking to requires any other authentication scheme, you can also pass -this header explicitly. This is common when using (RESTful) HTTP APIs that use -OAuth access tokens or JSON Web Tokens (JWT):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $token = 'abc123';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promise = $browser->get(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'https://example.com/api',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'Authorization' => 'Bearer ' . $token
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                When following redirects, the Authorization request header will never be sent -to any remote hosts by default. When following a redirect where the Location -response header contains authentication details, these details will be sent for -following requests. See also redirects below.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Redirects

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, this library follows any redirects and obeys 3xx (Redirection) -status codes using the Location response header from the remote server. -The promise will be fulfilled with the last response from the chain of redirects.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->get($url, $headers)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // the final response will end up here
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getHeaders());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Any redirected requests will follow the semantics of the original request and -will include the same request headers as the original request except for those -listed below. -If the original request is a temporary (307) or a permanent (308) redirect, request -body and headers will be passed to the redirected request. Otherwise, the request -body will never be passed to the redirected request. Accordingly, each redirected -request will remove any Content-Length and Content-Type request headers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If the original request used HTTP authentication with an Authorization request -header, this request header will only be passed as part of the redirected -request if the redirected URL is using the same host. In other words, the -Authorizaton request header will not be forwarded to other foreign hosts due to -possible privacy/security concerns. When following a redirect where the Location -response header contains authentication details, these details will be sent for -following requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can use the withFollowRedirects() method to -control the maximum number of redirects to follow or to return any redirect -responses as-is and apply custom redirection logic like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withFollowRedirects(false);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // any redirects will now end up here
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getHeaders());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also withFollowRedirects() for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Blocking

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                As stated above, this library provides you a powerful, async API by default.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can also integrate this into your traditional, blocking environment by using -reactphp/async. This allows you to simply -await async HTTP requests like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                use function React\Async\await;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promise = $browser->get('http://example.com/');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -try {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $response = await($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // response successfully received
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -} catch (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // an error occurred while performing the request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Similarly, you can also process multiple requests concurrently and await an array of Response objects:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                use function React\Async\await;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -use function React\Promise\all;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promises = array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $browser->get('http://example.com/'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $browser->get('http://www.example.org/'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$responses = await(all($promises));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is made possible thanks to fibers available in PHP 8.1+ and our -compatibility API that also works on all supported PHP versions. -Please refer to reactphp/async for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Keep in mind the above remark about buffering the whole response message in memory. -As an alternative, you may also see one of the following chapters for the -streaming API.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Concurrency

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                As stated above, this library provides you a powerful, async API. Being able to -send a large number of requests at once is one of the core features of this -project. For instance, you can easily send 100 requests concurrently while -processing SQL queries at the same time.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Remember, with great power comes great responsibility. Sending an excessive -number of requests may either take up all resources on your side or it may even -get you banned by the remote side if it sees an unreasonable number of requests -from your side.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // watch out if array contains many elements
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -foreach ($urls as $url) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        var_dump($response->getHeaders());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                As a consequence, it's usually recommended to limit concurrency on the sending -side to a reasonable value. It's common to use a rather small limit, as doing -more than a dozen of things at once may easily overwhelm the receiving side. You -can use clue/reactphp-mq as a lightweight -in-memory queue to concurrently do many (but not too many) things at once:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // wraps Browser in a Queue object that executes no more than 10 operations at once
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$q = new Clue\React\Mq\Queue(10, null, function ($url) use ($browser) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    return $browser->get($url);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -foreach ($urls as $url) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $q($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        var_dump($response->getHeaders());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Additional requests that exceed the concurrency limit will automatically be -enqueued until one of the pending requests completes. This integrates nicely -with the existing Promise-based API. Please refer to -clue/reactphp-mq for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This in-memory approach works reasonably well for some thousand outstanding -requests. If you're processing a very large input list (think millions of rows -in a CSV or NDJSON file), you may want to look into using a streaming approach -instead. See clue/reactphp-flux for -more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Streaming response

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                All of the above examples assume you want to store the whole response body in memory. -This is easy to get started and works reasonably well for smaller responses.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                However, there are several situations where it's usually a better idea to use a -streaming approach, where only small chunks have to be kept in memory:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If you're dealing with lots of concurrent requests (100+) or
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If you want to process individual data chunks as they happen (without having to wait for the full response body) or
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If you're expecting a big response body size (1 MiB or more, for example when downloading binary files) or
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • If you're unsure about the response body size (better be safe than sorry when accessing arbitrary remote HTTP endpoints and the response body size is unknown in advance).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can use the requestStreaming() method to send an -arbitrary HTTP request and receive a streaming response. It uses the same HTTP -message API, but does not buffer the response body in memory. It only processes -the response body in small chunks as data is received and forwards this data -through ReactPHP's Stream API. This works -for (any number of) responses of arbitrary sizes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This means it resolves with a normal -PSR-7 ResponseInterface, -which can be used to access the response message parameters as usual. -You can access the message body as usual, however it now also -implements ReactPHP's ReadableStreamInterface -as well as parts of the PSR-7 StreamInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->requestStreaming('GET', $url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body = $response->getBody();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    assert($body instanceof Psr\Http\Message\StreamInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    assert($body instanceof React\Stream\ReadableStreamInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo '[DONE]' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the stream download benchmark example and -the stream forwarding example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can invoke the following methods on the message body:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $body->on($event, $callback);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->eof();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->isReadable();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->pipe(React\Stream\WritableStreamInterface $dest, array $options = array());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->resume();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Because the message body is in a streaming state, invoking the following methods -doesn't make much sense:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $body->__toString(); // ''
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->detach(); // throws BadMethodCallException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->getSize(); // null
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->tell(); // throws BadMethodCallException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->isSeekable(); // false
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->seek(); // throws BadMethodCallException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->rewind(); // throws BadMethodCallException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->isWritable(); // false
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->write(); // throws BadMethodCallException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->read(); // throws BadMethodCallException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$body->getContents(); // throws BadMethodCallException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note how timeouts apply slightly differently when using streaming. -In streaming mode, the timeout value covers creating the underlying transport -connection, sending the HTTP request, receiving the HTTP response headers and -following any eventual redirects. In particular, the timeout value -does not take receiving (possibly large) response bodies into account.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to integrate the streaming response into a higher level API, then -working with Promise objects that resolve with Stream objects is often inconvenient. -Consider looking into also using react/promise-stream. -The resulting streaming code could look something like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                use React\Promise\Stream;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -function download(Browser $browser, string $url): React\Stream\ReadableStreamInterface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    return Stream\unwrapReadable(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        $browser->requestStreaming('GET', $url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            return $response->getBody();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        })
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$stream = download($browser, $url);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$stream->on('data', function ($data) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo $data;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$stream->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the requestStreaming() method for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Streaming request

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Besides streaming the response body, you can also stream the request body. -This can be useful if you want to send big POST requests (uploading files etc.) -or process many outgoing streams at once. -Instead of passing the body as a string, you can simply pass an instance -implementing ReactPHP's ReadableStreamInterface -to the request methods like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->post($url, array(), $stream)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Successfully sent.';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you're using a streaming request body (React\Stream\ReadableStreamInterface), it will -default to using Transfer-Encoding: chunked or you have to explicitly pass in a -matching Content-Length request header like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $body = new React\Stream\ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(1.0, function () use ($body) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->end("hello world");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->post($url, array('Content-Length' => '11'), $body);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If the streaming request body emits an error event or is explicitly closed -without emitting a successful end event first, the request will automatically -be closed and rejected.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP proxy

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can also establish your outgoing connections through an HTTP CONNECT proxy server -by adding a dependency to clue/reactphp-http-proxy.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP CONNECT proxy servers (also commonly known as "HTTPS proxy" or "SSL proxy") -are commonly used to tunnel HTTPS traffic through an intermediary ("proxy"), to -conceal the origin address (anonymity) or to circumvent address blocking -(geoblocking). While many (public) HTTP CONNECT proxy servers often limit this -to HTTPS port 443 only, this can technically be used to tunnel any TCP/IP-based -protocol, such as plain HTTP and TLS-encrypted HTTPS.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $proxy = new Clue\React\HttpProxy\ProxyConnector('127.0.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tcp' => $proxy,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'dns' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the HTTP proxy example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                SOCKS proxy

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can also establish your outgoing connections through a SOCKS proxy server -by adding a dependency to clue/reactphp-socks.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The SOCKS proxy protocol family (SOCKS5, SOCKS4 and SOCKS4a) is commonly used to -tunnel HTTP(S) traffic through an intermediary ("proxy"), to conceal the origin -address (anonymity) or to circumvent address blocking (geoblocking). While many -(public) SOCKS proxy servers often limit this to HTTP(S) port 80 and 443 -only, this can technically be used to tunnel any TCP/IP-based protocol.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $proxy = new Clue\React\Socks\Client('127.0.0.1:1080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tcp' => $proxy,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'dns' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the SOCKS proxy example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                SSH proxy

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can also establish your outgoing connections through an SSH server -by adding a dependency to clue/reactphp-ssh-proxy.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Secure Shell (SSH) is a secure -network protocol that is most commonly used to access a login shell on a remote -server. Its architecture allows it to use multiple secure channels over a single -connection. Among others, this can also be used to create an "SSH tunnel", which -is commonly used to tunnel HTTP(S) traffic through an intermediary ("proxy"), to -conceal the origin address (anonymity) or to circumvent address blocking -(geoblocking). This can be used to tunnel any TCP/IP-based protocol (HTTP, SMTP, -IMAP etc.), allows you to access local services that are otherwise not accessible -from the outside (database behind firewall) and as such can also be used for -plain HTTP and TLS-encrypted HTTPS.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $proxy = new Clue\React\SshProxy\SshSocksConnector('alice@example.com');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tcp' => $proxy,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'dns' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the SSH proxy example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Unix domain sockets

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, this library supports transport over plaintext TCP/IP and secure -TLS connections for the http:// and https:// URL schemes respectively. -This library also supports Unix domain sockets (UDS) when explicitly configured.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to use a UDS path, you have to explicitly configure the connector to -override the destination URL so that the hostname given in the request URL will -no longer be used to establish the connection:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector = new React\Socket\FixedUriConnector(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'unix:///var/run/docker.sock',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Socket\UnixConnector()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$client->get('http://localhost/info')->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getHeaders(), (string)$response->getBody());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the Unix Domain Sockets (UDS) example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Server Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HttpServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Http\HttpServer class is responsible for handling incoming connections and then +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        "Hello World!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$socket = new React\Socket\Server(8080, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Server

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The Server class is responsible for handling incoming connections and then processing each incoming HTTP request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                When a complete HTTP request has been received, it will invoke the given -request handler function. This request handler function needs to be passed to -the constructor and will be invoked with the respective request -object and expects a response object in return:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        "Hello World!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Each incoming HTTP request message is always represented by the -PSR-7 ServerRequestInterface, -see also following request chapter for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Each outgoing HTTP response message is always represented by the -PSR-7 ResponseInterface, -see also following response chapter for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to start listening for any incoming connections, the HttpServer needs -to be attached to an instance of -React\Socket\ServerInterface -through the listen() method as described in the following -chapter. In its most simple form, you can attach this to a -React\Socket\SocketServer -in order to start a plaintext HTTP server like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$socket = new React\Socket\SocketServer('0.0.0.0:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$http->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the listen() method and the -hello world server example -for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, the HttpServer buffers and parses the complete incoming HTTP -request in memory. It will invoke the given request handler function when the -complete request headers and request body has been received. This means the -request object passed to your request handler function will be -fully compatible with PSR-7 (http-message). This provides sane defaults for -80% of the use cases and is the recommended way to use this library unless -you're sure you know what you're doing.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                On the other hand, buffering complete HTTP requests in memory until they can -be processed by your request handler function means that this class has to -employ a number of limits to avoid consuming too much memory. In order to -take the more advanced configuration out your hand, it respects setting from -your php.ini to apply its -default settings. This is a list of PHP settings this class respects with -their respective default values:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                memory_limit 128M
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -post_max_size 8M // capped at 64K
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -enable_post_data_reading 1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -max_input_nesting_level 64
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -max_input_vars 1000
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -file_uploads 1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -upload_max_filesize 2M
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -max_file_uploads 20
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In particular, the post_max_size setting limits how much memory a single -HTTP request is allowed to consume while buffering its request body. This -needs to be limited because the server can process a large number of requests -concurrently, so the server may potentially consume a large amount of memory -otherwise. To support higher concurrency by default, this value is capped -at 64K. If you assign a higher value, it will only allow 64K by default. -If a request exceeds this limit, its request body will be ignored and it will -be processed like a request with no request body at all. See below for -explicit configuration to override this setting.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, this class will try to avoid consuming more than half of your -memory_limit for buffering multiple concurrent HTTP requests. As such, with -the above default settings of 128M max, it will try to consume no more than -64M for buffering multiple concurrent HTTP requests. As a consequence, it -will limit the concurrency to 1024 HTTP requests with the above defaults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                It is imperative that you assign reasonable values to your PHP ini settings. -It is usually recommended to not support buffering incoming HTTP requests -with a large HTTP request body (e.g. large file uploads). If you want to -increase this buffer size, you will have to also increase the total memory -limit to allow for more concurrent requests (set memory_limit 512M or more) -or explicitly limit concurrency.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to override the above buffering defaults, you can configure the -HttpServer explicitly. You can use the -LimitConcurrentRequestsMiddleware and -RequestBodyBufferMiddleware (see below) -to explicitly configure the total number of requests that can be handled at -once like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyBufferMiddleware(2 * 1024 * 1024), // 2 MiB per request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyParserMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In this example, we allow processing up to 100 concurrent requests at once -and each request can buffer up to 2M. This means you may have to keep a -maximum of 200M of memory for incoming request body buffers. Accordingly, -you need to adjust the memory_limit ini setting to allow for these buffers -plus your actual application logic memory requirements (think 512M or more).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                It buffers and parses the complete incoming HTTP request in memory. Once the +complete request has been received, it will invoke the request handler.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                For each request, it executes the callback function passed to the +constructor with the respective request object and expects +a respective response object in return.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        "Hello World!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                For most users a server that buffers and parses a requests before handling it over as a +PSR-7 request is what they want. The Server facade takes care of that, and takes the more +advanced configuration out of hand. Under the hood it uses StreamingServer +with the the three stock middleware using default settings from php.ini.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The LimitConcurrentRequestsMiddleware requires a limit, +as such the Server facade uses the memory_limit and post_max_size ini settings to +calculate a sensible limit. It assumes a maximum of a quarter of the memory_limit for +buffering and the other three quarter for parsing and handling the requests. The limit is +division of half of memory_limit by memory_limit rounded up.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internally, this class automatically assigns these middleware handlers -automatically when no StreamingRequestMiddleware -is given. Accordingly, you can use this example to override all default -settings to implement custom limits.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that any errors emitted by the wrapped StreamingServer are forwarded by Server.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                As an alternative to buffering the complete request body in memory, you can -also use a streaming approach where only small chunks of data have to be kept -in memory:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In this case, it will invoke the request handler function once the HTTP -request headers have been received, i.e. before receiving the potentially -much larger HTTP request body. This means the request passed to -your request handler function may not be fully compatible with PSR-7. This is -specifically designed to help with more advanced use cases where you want to -have full control over consuming the incoming HTTP request body and -concurrency settings. See also streaming incoming request -below for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Changelog v1.5.0: This class has been renamed to HttpServer from the -previous Server class in order to avoid any ambiguities. -The previous name has been deprecated and should not be used anymore.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                listen()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The listen(React\Socket\ServerInterface $socket): void method can be used to -start listening for HTTP requests on the given socket server instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The given React\Socket\ServerInterface -is responsible for emitting the underlying streaming connections. This -HTTP server needs to be attached to it in order to process any -connections and pase incoming streaming data as incoming HTTP request -messages. In its most common form, you can attach this to a -React\Socket\SocketServer +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +StreamingServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The advanced StreamingServer class is responsible for handling incoming connections and then +processing each incoming HTTP request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Unlike the Server class, it does not buffer and parse the incoming +HTTP request body by default. This means that the request handler will be +invoked with a streaming request body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                For each request, it executes the callback function passed to the +constructor with the respective request object and expects +a respective response object in return.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new StreamingServer(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        "Hello World!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to process any connections, the server needs to be attached to an +instance of React\Socket\ServerInterface which emits underlying streaming +connections in order to then parse incoming data as HTTP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can attach this to a +React\Socket\Server in order to start a plaintext HTTP server like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$socket = new React\Socket\SocketServer('0.0.0.0:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$http->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also hello world server example -for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This example will start listening for HTTP requests on the alternative -HTTP port 8080 on all interfaces (publicly). As an alternative, it is -very common to use a reverse proxy and let this HTTP server listen on the -localhost (loopback) interface only by using the listen address -127.0.0.1:8080 instead. This way, you host your application(s) on the -default HTTP port 80 and only route specific requests to this HTTP -server.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Likewise, it's usually recommended to use a reverse proxy setup to accept -secure HTTPS requests on default HTTPS port 443 (TLS termination) and -only route plaintext requests to this HTTP server. As an alternative, you -can also accept secure HTTPS requests with this HTTP server by attaching -this to a React\Socket\SocketServer -using a secure TLS listen address, a certificate file and optional -passphrase like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$socket = new React\Socket\SocketServer('tls://0.0.0.0:8443', array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'local_cert' => __DIR__ . '/localhost.pem'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$http->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also hello world HTTPS example -for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Server Request

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                As seen above, the HttpServer class is responsible for handling -incoming connections and then processing each incoming HTTP request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new StreamingServer($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$socket = new React\Socket\Server(8080, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the listen() method and the first example for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Similarly, you can also attach this to a +React\Socket\SecureServer +in order to start a secure HTTPS server like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new StreamingServer($handler);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$socket = new React\Socket\Server(8080, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$socket = new React\Socket\SecureServer($socket, $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'local_cert' => __DIR__ . '/localhost.pem'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #11 for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                When HTTP/1.1 clients want to send a bigger request body, they MAY send only +the request headers with an additional Expect: 100-continue header and +wait before sending the actual (large) message body. +In this case the server will automatically send an intermediary +HTTP/1.1 100 Continue response to the client. +This ensures you will receive the request body without a delay as expected. +The Response still needs to be created as described in the +examples above.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also request and response +for more details (e.g. the request data body).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The StreamingServer supports both HTTP/1.1 and HTTP/1.0 request messages. +If a client sends an invalid request message, uses an invalid HTTP protocol +version or sends an invalid Transfer-Encoding in the request header, it will +emit an error event, send an HTTP error response to the client and +close the connection:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The server will also emit an error event if you return an invalid +type in the callback function or have a unhandled Exception or Throwable. +If your callback function throws an Exception or Throwable, +the StreamingServer will emit a RuntimeException and add the thrown exception +as previous:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    if ($e->getPrevious() !== null) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        $previousException = $e->getPrevious();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        echo $previousException->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the request object can also emit an error. +Check out request for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Request

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                As seen above, the Server and StreamingServer +classes are responsible for handling incoming connections and then processing +each incoming HTTP request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The request object will be processed once the request has been received by the client. This request object implements the -PSR-7 ServerRequestInterface +PSR-7 ServerRequestInterface which in turn extends the -PSR-7 RequestInterface +PSR-7 RequestInterface and will be passed to the callback function like this.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -   $body = "The method of the request is: " . $request->getMethod() . "\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -   $body .= "The requested path is: " . $request->getUri()->getPath() . "\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -   return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -       $body
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -   );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +   $body = "The method of the request is: " . $request->getMethod();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +   $body .= "The requested path is: " . $request->getUri()->getPath();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +   return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +       200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +       array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +           'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +       ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +       $body
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +   );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                                For more details about the request object, also check out the documentation of -PSR-7 ServerRequestInterface +PSR-7 ServerRequestInterface and -PSR-7 RequestInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Request parameters

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +PSR-7 RequestInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Request parameters

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The getServerParams(): mixed[] method can be used to get server-side parameters similar to the $_SERVER variable. The following parameters are currently available:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1050,133 +434,60 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTPS Set to 'on' if the request used HTTPS, otherwise it won't be set
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $body = "Your IP is: " . $request->getServerParams()['REMOTE_ADDR'] . "\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $body
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also whatsmyip server example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $body = "Your IP is: " . $request->getServerParams()['REMOTE_ADDR'];
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $body
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also example #3.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced: Note that address parameters will not be set if you're listening on a Unix domain socket (UDS) path as this protocol lacks the concept of host/port.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Query parameters

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Query parameters

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The getQueryParams(): array method can be used to get the query parameters similiar to the $_GET variable.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $queryParams = $request->getQueryParams();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $body = 'The query parameter "foo" is not set. Click the following link ';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $body .= '<a href="/?foo=bar">to use query parameter in your request</a>';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    if (isset($queryParams['foo'])) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $body = 'The value of "foo" is: ' . htmlspecialchars($queryParams['foo']);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return React\Http\Message\Response::html(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $body
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $queryParams = $request->getQueryParams();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $body = 'The query parameter "foo" is not set. Click the following link ';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $body .= '<a href="/?foo=bar">to use query parameter in your request</a>';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    if (isset($queryParams['foo'])) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $body = 'The value of "foo" is: ' . htmlspecialchars($queryParams['foo']);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Content-Type' => 'text/html'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $body
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The response in the above example will return a response body with a link. The URL contains the query parameter foo with the value bar. -Use htmlentities +Use htmlentities like in this example to prevent Cross-Site Scripting (abbreviated as XSS).

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also server query parameters example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Request body

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              By default, the Server will buffer and parse the full request body -in memory. This means the given request object includes the parsed request body -and any file uploads.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              As an alternative to the default buffering logic, you can also use the -StreamingRequestMiddleware. Jump to the next -chapter to learn more about how to process a -streaming incoming request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              As stated above, each incoming HTTP request is always represented by the -PSR-7 ServerRequestInterface. -This interface provides several methods that are useful when working with the -incoming request body as described below.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The getParsedBody(): null|array|object method can be used to -get the parsed request body, similar to -PHP's $_POST variable. -This method may return a (possibly nested) array structure with all body -parameters or a null value if the request body could not be parsed. -By default, this method will only return parsed data for requests using -Content-Type: application/x-www-form-urlencoded or Content-Type: multipart/form-data -request headers (commonly used for POST requests for HTML form submission data).

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $name = $request->getParsedBody()['name'] ?? 'anonymous';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        "Hello $name!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also form upload example for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The getBody(): StreamInterface method can be used to -get the raw data from this request body, similar to -PHP's php://input stream. -This method returns an instance of the request body represented by the -PSR-7 StreamInterface. -This is particularly useful when using a custom request body that will not -otherwise be parsed by default, such as a JSON (Content-Type: application/json) or -an XML (Content-Type: application/xml) request body (which is commonly used for -POST, PUT or PATCH requests in JSON-based or RESTful/RESTish APIs).

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $data = json_decode((string)$request->getBody());
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $name = $data->name ?? 'anonymous';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return React\Http\Message\Response::json(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        ['message' => "Hello $name!"]
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also JSON API server example for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The getUploadedFiles(): array method can be used to -get the uploaded files in this request, similar to -PHP's $_FILES variable. -This method returns a (possibly nested) array structure with all file uploads, each represented by the -PSR-7 UploadedFileInterface. -This array will only be filled when using the Content-Type: multipart/form-data -request header (commonly used for POST requests for HTML file uploads).

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $files = $request->getUploadedFiles();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $name = isset($files['avatar']) ? $files['avatar']->getClientFilename() : 'nothing';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        "Uploaded $name\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also form upload server example for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The getSize(): ?int method can be used to -get the size of the request body, similar to PHP's $_SERVER['CONTENT_LENGTH'] variable. -This method returns the complete size of the request body measured in number -of bytes as defined by the message boundaries. -This value may be 0 if the request message does not contain a request body -(such as a simple GET request). -This method operates on the buffered request body, i.e. the request body size -is always known, even when the request does not specify a Content-Length request -header or when using Transfer-Encoding: chunked for HTTP/1.1 requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note: The HttpServer automatically takes care of handling requests with the -additional Expect: 100-continue request header. When HTTP/1.1 clients want to -send a bigger request body, they MAY send only the request headers with an -additional Expect: 100-continue request header and wait before sending the actual -(large) message body. In this case the server will automatically send an -intermediary HTTP/1.1 100 Continue response to the client. This ensures you -will receive the request body without a delay as expected.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Streaming incoming request

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If you're using the advanced StreamingRequestMiddleware, -the request object will be processed once the request headers have been received. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also example #4.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Streaming request

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If you're using the Server, then the request object will be +buffered and parsed in memory and contains the full request body. +This includes the parsed request body and any file uploads.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If you're using the advanced StreamingServer, the +request object will be processed once the request headers have been received. This means that this happens irrespective of (i.e. before) receiving the (potentially much larger) request body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that this is non-standard behavior considered advanced usage. Jump to the -previous chapter to learn more about how to process a buffered request body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              While this may be uncommon in the PHP ecosystem, this is actually a very powerful approach that gives you several advantages not otherwise possible:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1188,55 +499,54 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Process a large request body without having to buffer anything in memory, such as accepting a huge file upload or possibly unlimited request body stream.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The getBody(): StreamInterface method can be used to -access the request body stream. -In the streaming mode, this method returns a stream instance that implements both the -PSR-7 StreamInterface -and the ReactPHP ReadableStreamInterface. -However, most of the -PSR-7 StreamInterface -methods have been designed under the assumption of being in control of a -synchronous request body. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The getBody() method can be used to access the request body stream. +In the default streaming mode, this method returns a stream instance that implements both the +PSR-7 StreamInterface +and the ReactPHP ReadableStreamInterface. +However, most of the PSR-7 StreamInterface methods have been +designed under the assumption of being in control of the request body. Given that this does not apply to this server, the following -PSR-7 StreamInterface -methods are not used and SHOULD NOT be called: +PSR-7 StreamInterface methods are not used and SHOULD NOT be called: tell(), eof(), seek(), rewind(), write() and read(). If this is an issue for your use case and/or you want to access uploaded files, -it's highly recommended to use a buffered request body or use the +it's highly recommended to use the RequestBodyBufferMiddleware instead. -The ReactPHP ReadableStreamInterface -gives you access to the incoming request body as the individual chunks arrive:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $body = $request->getBody();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        assert($body instanceof Psr\Http\Message\StreamInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        assert($body instanceof React\Stream\ReadableStreamInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        return new React\Promise\Promise(function ($resolve, $reject) use ($body) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            $bytes = 0;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            $body->on('data', function ($data) use (&$bytes) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -                $bytes += strlen($data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            $body->on('end', function () use ($resolve, &$bytes){
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -                $resolve(React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -                    "Received $bytes bytes\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -                ));
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            // an error occures e.g. on invalid chunked encoded data or an unexpected 'end' event
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            $body->on('error', function (Exception $e) use ($resolve, &$bytes) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -                $resolve(React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -                    "Encountered error after $bytes bytes: {$e->getMessage()}\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -                )->withStatus(React\Http\Message\Response::STATUS_BAD_REQUEST));
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +The ReactPHP ReadableStreamInterface gives you access to the incoming +request body as the individual chunks arrive:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new StreamingServer(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Promise(function ($resolve, $reject) use ($request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $contentLength = 0;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $request->getBody()->on('data', function ($data) use (&$contentLength) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            $contentLength += strlen($data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $request->getBody()->on('end', function () use ($resolve, &$contentLength){
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            $response = new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                    'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                "The length of the submitted request body is: " . $contentLength
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            $resolve($response);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        // an error occures e.g. on invalid chunked encoded data or an unexpected 'end' event
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $request->getBody()->on('error', function (\Exception $exception) use ($resolve, &$contentLength) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            $response = new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                400,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                    'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                "An error occured while reading at length: " . $contentLength
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            $resolve($response);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The above example simply counts the number of bytes received in the request body. This can be used as a skeleton for buffering or processing the request body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also streaming request server example for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also example #9 for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The data event will be emitted whenever new data is available on the request body stream. The server also automatically takes care of decoding any incoming requests using @@ -1251,43 +561,40 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              A response message can still be sent (unless the connection is already closed).

                                                                                                                                                                                                                                                                                                                                                                                                                                                              A close event will be emitted after an error or end event.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              For more details about the request body stream, check out the documentation of -ReactPHP ReadableStreamInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The getSize(): ?int method can be used to -get the size of the request body, similar to PHP's $_SERVER['CONTENT_LENGTH'] variable. -This method returns the complete size of the request body measured in number -of bytes as defined by the message boundaries. +ReactPHP ReadableStreamInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The getSize(): ?int method can be used if you only want to know the request +body size. +This method returns the complete size of the request body as defined by the +message boundaries. This value may be 0 if the request message does not contain a request body (such as a simple GET request). -This method operates on the streaming request body, i.e. the request body size -may be unknown (null) when using Transfer-Encoding: chunked for HTTP/1.1 requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $size = $request->getBody()->getSize();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        if ($size === null) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            $body = "The request does not contain an explicit length. ";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            $body .= "This example does not accept chunked transfer encoding.\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -                $body
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            )->withStatus(React\Http\Message\Response::STATUS_LENGTH_REQUIRED);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            "Request body size: " . $size . " bytes\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note: The HttpServer automatically takes care of handling requests with the -additional Expect: 100-continue request header. When HTTP/1.1 clients want to -send a bigger request body, they MAY send only the request headers with an -additional Expect: 100-continue request header and wait before sending the actual -(large) message body. In this case the server will automatically send an -intermediary HTTP/1.1 100 Continue response to the client. This ensures you -will receive the streaming request body without a delay as expected.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Request method

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Note that this value may be null if the request body size is unknown in +advance because the request message uses Transfer-Encoding: chunked.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new StreamingServer(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $size = $request->getBody()->getSize();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    if ($size === null) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $body = 'The request does not contain an explicit length.';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $body .= 'This example does not accept chunked transfer encoding.';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            411,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            $body
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        "Request body size: " . $size . " bytes\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Request method

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that the server supports any request method (including custom and non- standard ones) and all request-target formats defined in the HTTP specs for each respective method, including normal origin-form requests as well as @@ -1298,7 +605,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              or may not be present, for example the getPath(): string method will return an empty string for requests in asterisk-form or authority-form. Its getHost(): string method will return the host as determined by the -effective request URI, which defaults to the local socket address if an HTTP/1.0 +effective request URI, which defaults to the local socket address if a HTTP/1.0 client did not specify one (i.e. no Host header). Its getScheme(): string method will return http or https depending on whether the request was made over a secure TLS connection to the target host.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1315,67 +622,67 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              request-target than the Host header value (such as removing default ports) and the request-target MUST take precendence when forwarding.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Cookie parameters

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Cookie parameters

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The getCookieParams(): string[] method can be used to get all cookies sent with the current request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $key = 'greeting';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    if (isset($request->getCookieParams()[$key])) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $body = "Your cookie value is: " . $request->getCookieParams()[$key] . "\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            $body
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        "Your cookie has been set.\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    )->withHeader('Set-Cookie', $key . '=' . urlencode('Hello world!'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $key = 'react\php';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    if (isset($request->getCookieParams()[$key])) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $body = "Your cookie value is: " . $request->getCookieParams()[$key];
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            $body
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Content-Type' => 'text/plain',
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Set-Cookie' => urlencode($key) . '=' . urlencode('test;more')
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        "Your cookie has been set."
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The above example will try to set a cookie on first access and will try to print the cookie value on all subsequent tries. Note how the example uses the urlencode() function to encode non-alphanumeric characters. This encoding is also used internally when decoding the name and value of cookies (which is in line with other implementations, such as PHP's cookie functions).

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also cookie server example for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Invalid request

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The HttpServer class supports both HTTP/1.1 and HTTP/1.0 request messages. -If a client sends an invalid request message, uses an invalid HTTP -protocol version or sends an invalid Transfer-Encoding request header value, -the server will automatically send a 400 (Bad Request) HTTP error response -to the client and close the connection. -On top of this, it will emit an error event that can be used for logging -purposes like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that the server will also emit an error event if you do not return a -valid response object from your request handler function. See also -invalid response for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Server Response

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The callback function passed to the constructor of the HttpServer is -responsible for processing the request and returning a response, which will be -delivered to the client.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This function MUST return an instance implementing -PSR-7 ResponseInterface +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              See also example #5 for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Response

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The callback function passed to the constructor of the Server or +advanced StreamingServer is responsible for processing the request +and returning a response, which will be delivered to the client. +This function MUST return an instance implementing +PSR-7 ResponseInterface object or a -ReactPHP Promise -which resolves with a PSR-7 ResponseInterface object.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This projects ships a Response class which implements the -PSR-7 ResponseInterface. -In its most simple form, you can use it like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        "Hello World!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              We use this Response class throughout our project examples, but -feel free to use any other implementation of the -PSR-7 ResponseInterface. -See also the Response class for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Deferred response

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +ReactPHP Promise +which will resolve a PSR-7 ResponseInterface object.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              You will find a Response class +which implements the PSR-7 ResponseInterface in this project. +We use instantiation of this class in our projects, +but feel free to use any implemantation of the +PSR-7 ResponseInterface you prefer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        "Hello World!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Deferred response

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The example above returns the response directly, because it needs no time to be processed. Using a database, the file system or long calculations @@ -1384,19 +691,20 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              To prevent this you SHOULD use a ReactPHP Promise. This example shows how such a long-term action could look like:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $promise = new Promise(function ($resolve, $reject) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        Loop::addTimer(1.5, function() use ($resolve) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            $resolve();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return $promise->then(function () { 
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            "Hello World!"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new Server(function (ServerRequestInterface $request) use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Promise(function ($resolve, $reject) use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $loop->addTimer(1.5, function() use ($resolve) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            $response = new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                    'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +                "Hello world"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            $resolve($response);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The above example will create a response after 1.5 second. This example shows that you need a promise, if your response needs time to created. @@ -1407,42 +715,34 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The promise cancellation handler can be used to clean up any pending resources allocated in this case (if applicable). If a promise is resolved after the client closes, it will simply be ignored.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Streaming outgoing response

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Streaming response

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The Response class in this project supports to add an instance which implements the -ReactPHP ReadableStreamInterface +ReactPHP ReadableStreamInterface for the response body. So you are able stream data directly into the response body. -Note that other implementations of the -PSR-7 ResponseInterface -may only support strings.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $stream = new ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    // send some data every once in a while with periodic timer
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $timer = Loop::addPeriodicTimer(0.5, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $stream->write(microtime(true) . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    // end stream after a few seconds
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $timeout = Loop::addTimer(5.0, function() use ($stream, $timer) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        Loop::cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $stream->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    // stop timer if stream is closed (such as when connection is closed)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $stream->on('close', function () use ($timer, $timeout) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        Loop::cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        Loop::cancelTimer($timeout);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $stream
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Note that other implementations of the PSR-7 ResponseInterface likely +only support strings.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new Server(function (ServerRequestInterface $request) use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $stream = new ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $timer = $loop->addPeriodicTimer(0.5, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $stream->emit('data', array(microtime(true) . PHP_EOL));
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $loop->addTimer(5, function() use ($loop, $timer, $stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $loop->cancelTimer($timer);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $stream->emit('end');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $stream
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The above example will emit every 0.5 seconds the current Unix timestamp with microseconds as float to the client and will end after 5 seconds. This is just a example you could use of the streaming, @@ -1469,9 +769,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              writable side of the stream. This can be avoided by either rejecting all requests with the CONNECT method (which is what most normal origin HTTP servers would likely do) or -or ensuring that only ever an instance of -ReactPHP's ReadableStreamInterface -is used.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +or ensuring that only ever an instance of ReadableStreamInterface is +used.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The 101 (Switching Protocols) response code is useful for the more advanced Upgrade requests, such as upgrading to the WebSocket protocol or implementing custom protocol logic that is out of scope of the HTTP specs and @@ -1480,7 +779,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              to look into using Ratchet instead. If you want to handle a custom protocol, you will likely want to look into the HTTP specs and also see -examples #81 and #82 for more details. +examples #31 and #32 for more details. In particular, the 101 (Switching Protocols) response code MUST NOT be used unless you send an Upgrade response header value that is also present in the corresponding HTTP/1.1 Upgrade request header value. @@ -1500,39 +799,30 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              requests, one may still be present. Normal request body processing applies here and the connection will only turn to "tunneling mode" after the request body has been processed (which should be empty in most cases). -See also HTTP CONNECT server example for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +See also example #22 for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Response length

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If the response body size is known, a Content-Length response header will be -added automatically. This is the most common use case, for example when using -a string response body like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        "Hello World!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If the response body size is unknown, a Content-Length response header can not -be added automatically. When using a streaming outgoing response -without an explicit Content-Length response header, outgoing HTTP/1.1 response -messages will automatically use Transfer-Encoding: chunked while legacy HTTP/1.0 -response messages will contain the plain response body. If you know the length -of your streaming response body, you MAY want to specify it explicitly like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $stream = new ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    Loop::addTimer(2.0, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $stream->end("Hello World!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            'Content-Length' => '13',
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            'Content-Type' => 'text/plain',
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        $stream
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Response length

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If the response body is a string, a Content-Length header will be added +automatically.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If the response body is a ReactPHP ReadableStreamInterface and you do not +specify a Content-Length header, outgoing HTTP/1.1 response messages will +automatically use Transfer-Encoding: chunked and send the respective header +automatically. +The server is responsible for handling Transfer-Encoding, so you SHOULD NOT +pass this header yourself.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If you know the length of your stream body, you MAY specify it like this instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $stream = new ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$server = new Server(function (ServerRequestInterface $request) use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Content-Length' => '5',
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Content-Type' => 'text/plain',
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        $stream
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Any response to a HEAD request and any response with a 1xx (Informational), 204 (No Content) or 304 (Not Modified) status code will not include a message body as per the HTTP specs. @@ -1546,112 +836,81 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Modified) status code MAY include these headers even though the message does not contain a response body, because these header would apply to the message if the same request would have used an (unconditional) GET.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Invalid response

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              As stated above, each outgoing HTTP response is always represented by the -PSR-7 ResponseInterface. -If your request handler function returns an invalid value or throws an -unhandled Exception or Throwable, the server will automatically send a 500 -(Internal Server Error) HTTP error response to the client. -On top of this, it will emit an error event that can be used for logging -purposes like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    if ($e->getPrevious() !== null) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        echo 'Previous: ' . $e->getPrevious()->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that the server will also emit an error event if the client sends an -invalid HTTP request that never reaches your request handler function. See -also invalid request for more details. -Additionally, a streaming incoming request body -can also emit an error event on the request body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The server will only send a very generic 500 (Interval Server Error) HTTP -error response without any further details to the client if an unhandled -error occurs. While we understand this might make initial debugging harder, -it also means that the server does not leak any application details or stack -traces to the outside by default. It is usually recommended to catch any -Exception or Throwable within your request handler function or alternatively -use a middleware to avoid this generic error handling and -create your own HTTP response message instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Default response headers

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              When a response is returned from the request handler function, it will be -processed by the HttpServer and then sent back to the client.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              A Server: ReactPHP/1 response header will be added automatically. You can add -a custom Server response header like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            'Server' => 'PHP/3'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If you do not want to send this Sever response header at all (such as when you -don't want to expose the underlying server software), you can use an empty -string value like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            'Server' => ''
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              A Date response header will be added automatically with the current system -date and time if none is given. You can add a custom Date response header -like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            'Date' => gmdate('D, d M Y H:i:s \G\M\T')
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If you do not want to send this Date response header at all (such as when you -don't have an appropriate clock to rely on), you can use an empty string value -like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $http = new React\Http\HttpServer(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -            'Date' => ''
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The HttpServer class will automatically add the protocol version of the request, -so you don't have to. For instance, if the client sends the request using the -HTTP/1.1 protocol version, the response message will also use the same protocol -version, no matter what version is returned from the request handler function.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The server supports persistent connections. An appropriate Connection: keep-alive -or Connection: close response header will be added automatically, respecting the -matching request header value and HTTP default header values. The server is -responsible for handling the Connection response header, so you SHOULD NOT pass -this response header yourself, unless you explicitly want to override the user's -choice with a Connection: close response header.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Middleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              As documented above, the HttpServer accepts a single request handler -argument that is responsible for processing an incoming HTTP request and then -creating and returning an outgoing HTTP response.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Invalid response

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              An invalid return value or an unhandled Exception or Throwable in the code +of the callback function, will result in an 500 Internal Server Error message. +Make sure to catch Exceptions or Throwables to create own response messages.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Default response headers

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              After the return in the callback function the response will be processed by the +Server or StreamingServer respectively. +They will add the protocol version of the request, so you don't have to.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              A Date header will be automatically added with the system date and time if none is given. +You can add a custom Date header yourself like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Date' => date('D, d M Y H:i:s T')
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If you don't have a appropriate clock to rely on, you should +unset this header with an empty string:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'Date' => ''
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that it will automatically assume a X-Powered-By: react/alpha header +unless your specify a custom X-Powered-By header yourself:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'X-Powered-By' => 'PHP 3'
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              If you do not want to send this header at all, you can use an empty string as +value like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new Server(function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +            'X-Powered-By' => ''
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        )
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that persistent connections (Connection: keep-alive) are currently +not supported. +As such, HTTP/1.1 response messages will automatically include a +Connection: close header, irrespective of what header values are +passed explicitly.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +Middleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              As documented above, the Server and advanced +StreamingServer accept a single +request handler argument that is responsible for processing an incoming +HTTP request and then creating and returning an outgoing HTTP response.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Many common use cases involve validating, processing, manipulating the incoming HTTP request before passing it to the final business logic request handler. As such, this project supports the concept of middleware request handlers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Custom middleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                              A middleware request handler is expected to adhere the following rules:

                                                                                                                                                                                                                                                                                                                                                                                                                                                              • It is a valid callable.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • It accepts an instance implementing -PSR-7 ServerRequestInterface -as first argument and an optional callable as second argument.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • It accepts ServerRequestInterface as first argument and an optional +callable as second argument.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • It returns either:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • An instance implementing -PSR-7 ResponseInterface -for direct consumption.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • An instance implementing ResponseInterface for direct consumption.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Any promise which can be consumed by -Promise\resolve() resolving to a -PSR-7 ResponseInterface -for deferred consumption.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +Promise\resolve() resolving to a +ResponseInterface for deferred consumption.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • It MAY throw an Exception (or return a rejected promise) in order to signal an error condition and abort the chain.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1684,19 +943,20 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                                As such, this project only bundles a few middleware implementations that are required to match PHP's request behavior (see below) and otherwise actively encourages Third-Party Middleware implementations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to use middleware request handlers, simply pass a list of all -callables as defined above to the HttpServer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to use middleware request handlers, simply pass an array with all +callables as defined above to the Server or +StreamingServer respectively. The following example adds a middleware request handler that adds the current time to the request as a -header (Request-Time) and a final request handler that always returns a 200 OK status code without a body:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Psr\Http\Message\ServerRequestInterface $request, callable $next) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        $request = $request->withHeader('Request-Time', time());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return $next($request);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return new React\Http\Message\Response(React\Http\Message\Response::STATUS_OK);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +header (Request-Time) and a final request handler that always returns a 200 code without a body:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    function (ServerRequestInterface $request, callable $next) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        $request = $request->withHeader('Request-Time', time());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return $next($request);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return new Response(200);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +));

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note how the middleware request handler and the final request handler have a very simple (and similar) interface. The only difference is that the final @@ -1705,713 +965,51 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Similarly, you can use the result of the $next middleware request handler function to modify the outgoing response. Note that as per the above documentation, the $next middleware request handler may return a -PSR-7 ResponseInterface -directly or one wrapped in a promise for deferred resolution. +ResponseInterface directly or one wrapped in a promise for deferred +resolution. In order to simplify handling both paths, you can simply wrap this in a -Promise\resolve() call like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Psr\Http\Message\ServerRequestInterface $request, callable $next) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        $promise = React\Promise\resolve($next($request));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return $promise->then(function (ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            return $response->withHeader('Content-Type', 'text/html');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return new React\Http\Message\Response(React\Http\Message\Response::STATUS_OK);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Promise\resolve() call like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    function (ServerRequestInterface $request, callable $next) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        $promise = React\Promise\resolve($next($request));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return $promise->then(function (ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            return $response->withHeader('Content-Type', 'text/html');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return new Response(200);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +));

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the $next middleware request handler may also throw an Exception (or return a rejected promise) as described above. The previous example does not catch any exceptions and would thus signal an -error condition to the HttpServer. +error condition to the Server. Alternatively, you can also catch any Exception to implement custom error handling logic (or logging etc.) by wrapping this in a -Promise like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Psr\Http\Message\ServerRequestInterface $request, callable $next) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        $promise = new React\Promise\Promise(function ($resolve) use ($next, $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            $resolve($next($request));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return $promise->then(null, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -                'Internal error: ' . $e->getMessage() . "\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            )->withStatus(React\Http\Message\Response::STATUS_INTERNAL_SERVER_ERROR);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        if (mt_rand(0, 1) === 1) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            throw new RuntimeException('Database error');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return new React\Http\Message\Response(React\Http\Message\Response::STATUS_OK);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Third-Party Middleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                While this project does provide the means to use middleware implementations -(see above), it does not aim to define how middleware implementations should -look like. We realize that there's a vivid ecosystem of middleware -implementations and ongoing effort to standardize interfaces between these with -PSR-15 (HTTP Server Request Handlers) -and support this goal. -As such, this project only bundles a few middleware implementations that are -required to match PHP's request behavior (see -middleware implementations) and otherwise actively -encourages third-party middleware implementations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                While we would love to support PSR-15 directly in react/http, we understand -that this interface does not specifically target async APIs and as such does -not take advantage of promises for deferred responses. -The gist of this is that where PSR-15 enforces a -PSR-7 ResponseInterface -return value, we also accept a PromiseInterface<ResponseInterface>. -As such, we suggest using the external -PSR-15 middleware adapter -that uses on the fly monkey patching of these return values which makes using -most PSR-15 middleware possible with this package without any changes required.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Other than that, you can also use the above middleware definition -to create custom middleware. A non-exhaustive list of third-party middleware can -be found at the middleware wiki. -If you build or know a custom middleware, make sure to let the world know and -feel free to add it to this list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                API

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Browser

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Http\Browser is responsible for sending HTTP requests to your HTTP server -and keeps track of pending incoming HTTP responses.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = new React\Http\Browser();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This class takes two optional arguments for more advanced usage:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                // constructor signature as of v1.5.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser(?ConnectorInterface $connector = null, ?LoopInterface $loop = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// legacy constructor signature before v1.5.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser(?LoopInterface $loop = null, ?ConnectorInterface $connector = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you need custom connector settings (DNS resolution, TLS parameters, timeouts, -proxy servers etc.), you can explicitly pass a custom instance of the -ConnectorInterface:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'dns' => '127.0.0.1',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tcp' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'bindto' => '192.168.10.1:0'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'verify_peer' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'verify_peer_name' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser = new React\Http\Browser($connector);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the browser class is final and shouldn't be extended, it is likely to be marked final in a future release.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                get()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The get(string $url, array $headers = array()): PromiseInterface<ResponseInterface> method can be used to -send an HTTP GET request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump((string)$response->getBody());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also GET request client example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                post()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The post(string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface> method can be used to -send an HTTP POST request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->post(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $url,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'Content-Type' => 'application/json'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    json_encode($data)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump(json_decode((string)$response->getBody()));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also POST JSON client example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method is also commonly used to submit HTML form data:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $data = [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'user' => 'Alice',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'password' => 'secret'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -];
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->post(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $url,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'Content-Type' => 'application/x-www-form-urlencoded'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    http_build_query($data)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method will automatically add a matching Content-Length request -header if the outgoing request body is a string. If you're using a -streaming request body (ReadableStreamInterface), it will default to -using Transfer-Encoding: chunked or you have to explicitly pass in a -matching Content-Length request header like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $body = new React\Stream\ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(1.0, function () use ($body) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->end("hello world");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->post($url, array('Content-Length' => '11'), $body);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                head()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The head(string $url, array $headers = array()): PromiseInterface<ResponseInterface> method can be used to -send an HTTP HEAD request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->head($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getHeaders());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                patch()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The patch(string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface> method can be used to -send an HTTP PATCH request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->patch(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $url,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'Content-Type' => 'application/json'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    json_encode($data)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump(json_decode((string)$response->getBody()));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method will automatically add a matching Content-Length request -header if the outgoing request body is a string. If you're using a -streaming request body (ReadableStreamInterface), it will default to -using Transfer-Encoding: chunked or you have to explicitly pass in a -matching Content-Length request header like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $body = new React\Stream\ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(1.0, function () use ($body) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->end("hello world");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->patch($url, array('Content-Length' => '11'), $body);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                put()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The put(string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface> method can be used to -send an HTTP PUT request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->put(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $url,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'Content-Type' => 'text/xml'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $xml->asXML()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump((string)$response->getBody());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also PUT XML client example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method will automatically add a matching Content-Length request -header if the outgoing request body is a string. If you're using a -streaming request body (ReadableStreamInterface), it will default to -using Transfer-Encoding: chunked or you have to explicitly pass in a -matching Content-Length request header like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $body = new React\Stream\ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(1.0, function () use ($body) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->end("hello world");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->put($url, array('Content-Length' => '11'), $body);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                delete()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The delete(string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface> method can be used to -send an HTTP DELETE request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->delete($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump((string)$response->getBody());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                request()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The request(string $method, string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface> method can be used to -send an arbitrary HTTP request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The preferred way to send an HTTP request is by using the above -request methods, for example the get() -method to send an HTTP GET request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                As an alternative, if you want to use a custom HTTP request method, you -can use this method:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->request('OPTIONS', $url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump((string)$response->getBody());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method will automatically add a matching Content-Length request -header if the size of the outgoing request body is known and non-empty. -For an empty request body, if will only include a Content-Length: 0 -request header if the request method usually expects a request body (only -applies to POST, PUT and PATCH).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you're using a streaming request body (ReadableStreamInterface), it -will default to using Transfer-Encoding: chunked or you have to -explicitly pass in a matching Content-Length request header like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $body = new React\Stream\ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(1.0, function () use ($body) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->end("hello world");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->request('POST', $url, array('Content-Length' => '11'), $body);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                requestStreaming()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The requestStreaming(string $method, string $url, array $headers = array(), string|ReadableStreamInterface $body = ''): PromiseInterface<ResponseInterface> method can be used to -send an arbitrary HTTP request and receive a streaming response without buffering the response body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The preferred way to send an HTTP request is by using the above -request methods, for example the get() -method to send an HTTP GET request. Each of these methods will buffer -the whole response body in memory by default. This is easy to get started -and works reasonably well for smaller responses.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                In some situations, it's a better idea to use a streaming approach, where -only small chunks have to be kept in memory. You can use this method to -send an arbitrary HTTP request and receive a streaming response. It uses -the same HTTP message API, but does not buffer the response body in -memory. It only processes the response body in small chunks as data is -received and forwards this data through ReactPHP's Stream API. -This works for (any number of) responses of arbitrary sizes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser->requestStreaming('GET', $url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body = $response->getBody();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    assert($body instanceof Psr\Http\Message\StreamInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    assert($body instanceof React\Stream\ReadableStreamInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo '[DONE]' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also ReactPHP's ReadableStreamInterface -and the streaming response for more details, -examples and possible use-cases.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method will automatically add a matching Content-Length request -header if the size of the outgoing request body is known and non-empty. -For an empty request body, if will only include a Content-Length: 0 -request header if the request method usually expects a request body (only -applies to POST, PUT and PATCH).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you're using a streaming request body (ReadableStreamInterface), it -will default to using Transfer-Encoding: chunked or you have to -explicitly pass in a matching Content-Length request header like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $body = new React\Stream\ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(1.0, function () use ($body) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body->end("hello world");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->requestStreaming('POST', $url, array('Content-Length' => '11'), $body);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                withTimeout()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The withTimeout(bool|number $timeout): Browser method can be used to -change the maximum timeout used for waiting for pending requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can pass in the number of seconds to use as a new timeout value:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withTimeout(10.0);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can pass in a bool false to disable any timeouts. In this case, -requests can stay pending forever:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withTimeout(false);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can pass in a bool true to re-enable default timeout handling. This -will respects PHP's default_socket_timeout setting (default 60s):

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withTimeout(true);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also timeouts for more details about timeout handling.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Notice that the Browser is an immutable object, i.e. this -method actually returns a new Browser instance with the -given timeout value applied.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                withFollowRedirects()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The withFollowRedirects(bool|int $followRedirects): Browser method can be used to -change how HTTP redirects will be followed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can pass in the maximum number of redirects to follow:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withFollowRedirects(5);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The request will automatically be rejected when the number of redirects -is exceeded. You can pass in a 0 to reject the request for any -redirects encountered:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withFollowRedirects(0);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // only non-redirected responses will now end up here
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getHeaders());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can pass in a bool false to disable following any redirects. In -this case, requests will resolve with the redirection response instead -of following the Location response header:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withFollowRedirects(false);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // any redirects will now end up here
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getHeaderLine('Location'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can pass in a bool true to re-enable default redirect handling. -This defaults to following a maximum of 10 redirects:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withFollowRedirects(true);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also redirects for more details about redirect handling.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Notice that the Browser is an immutable object, i.e. this -method actually returns a new Browser instance with the -given redirect setting applied.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                withRejectErrorResponse()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The withRejectErrorResponse(bool $obeySuccessCode): Browser method can be used to -change whether non-successful HTTP response status codes (4xx and 5xx) will be rejected.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can pass in a bool false to disable rejecting incoming responses -that use a 4xx or 5xx response status code. In this case, requests will -resolve with the response message indicating an error condition:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withRejectErrorResponse(false);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // any HTTP response will now end up here
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getStatusCode(), $response->getReasonPhrase());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can pass in a bool true to re-enable default status code handling. -This defaults to rejecting any response status codes in the 4xx or 5xx -range with a ResponseException:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withRejectErrorResponse(true);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // any successful HTTP response will now end up here
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getStatusCode(), $response->getReasonPhrase());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    if ($e instanceof React\Http\Message\ResponseException) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // any HTTP response error message will now end up here
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        $response = $e->getResponse();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        var_dump($response->getStatusCode(), $response->getReasonPhrase());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Notice that the Browser is an immutable object, i.e. this -method actually returns a new Browser instance with the -given setting applied.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                withBase()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The withBase(string|null $baseUrl): Browser method can be used to -change the base URL used to resolve relative URLs to.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you configure a base URL, any requests to relative URLs will be -processed by first resolving this relative to the given absolute base -URL. This supports resolving relative path references (like ../ etc.). -This is particularly useful for (RESTful) API calls where all endpoints -(URLs) are located under a common base URL.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withBase('http://api.example.com/v3/');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -// will request http://api.example.com/v3/users
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get('users')->then(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can pass in a null base URL to return a new instance that does not -use a base URL:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withBase(null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Accordingly, any requests using relative URLs to a browser that does not -use a base URL can not be completed and will be rejected without sending -a request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method will throw an InvalidArgumentException if the given -$baseUrl argument is not a valid URL.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Notice that the Browser is an immutable object, i.e. the withBase() method -actually returns a new Browser instance with the given base URL applied.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                withProtocolVersion()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The withProtocolVersion(string $protocolVersion): Browser method can be used to -change the HTTP protocol version that will be used for all subsequent requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                All the above request methods default to sending -requests as HTTP/1.1. This is the preferred HTTP protocol version which -also provides decent backwards-compatibility with legacy HTTP/1.0 -servers. As such, there should rarely be a need to explicitly change this -protocol version.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to explicitly use the legacy HTTP/1.0 protocol version, you -can use this method:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withProtocolVersion('1.0');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Notice that the Browser is an immutable object, i.e. this -method actually returns a new Browser instance with the -new protocol version applied.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                withResponseBuffer()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The withResponseBuffer(int $maximumSize): Browser method can be used to -change the maximum size for buffering a response body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The preferred way to send an HTTP request is by using the above -request methods, for example the get() -method to send an HTTP GET request. Each of these methods will buffer -the whole response body in memory by default. This is easy to get started -and works reasonably well for smaller responses.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, the response body buffer will be limited to 16 MiB. If the -response body exceeds this maximum size, the request will be rejected.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                You can pass in the maximum number of bytes to buffer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withResponseBuffer(1024 * 1024);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // response body will not exceed 1 MiB
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($response->getHeaders(), (string) $response->getBody());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the response body buffer has to be kept in memory for each -pending request until its transfer is completed and it will only be freed -after a pending request is fulfilled. As such, increasing this maximum -buffer size to allow larger response bodies is usually not recommended. -Instead, you can use the requestStreaming() method -to receive responses with arbitrary sizes without buffering. Accordingly, -this maximum buffer size setting has no effect on streaming responses.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Notice that the Browser is an immutable object, i.e. this -method actually returns a new Browser instance with the -given setting applied.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                withHeader()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The withHeader(string $header, string $value): Browser method can be used to -add a request header for all following requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withHeader('User-Agent', 'ACME');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the new header will overwrite any headers previously set with -the same name (case-insensitive). Following requests will use these headers -by default unless they are explicitly set for any requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                withoutHeader()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The withoutHeader(string $header): Browser method can be used to -remove any default request headers previously set via -the withHeader() method.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $browser = $browser->withoutHeader('User-Agent');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$browser->get($url)->then(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that this method only affects the headers which were set with the -method withHeader(string $header, string $value): Browser

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                React\Http\Message

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Response

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Http\Message\Response class can be used to -represent an outgoing server response message.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'Content-Type' => 'text/html'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    "<html>Hello world!</html>\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This class implements the -PSR-7 ResponseInterface -which in turn extends the -PSR-7 MessageInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                On top of this, this class implements the -PSR-7 Message Util StatusCodeInterface -which means that most common HTTP status codes are available as class -constants with the STATUS_* prefix. For instance, the 200 OK and -404 Not Found status codes can used as Response::STATUS_OK and -Response::STATUS_NOT_FOUND respectively.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internally, this implementation builds on top of a base class which is -considered an implementation detail that may change in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                html()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The static html(string $html): Response method can be used to -create an HTML response.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $html = <<<HTML
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -<!doctype html>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -<html>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -<body>Hello wörld!</body>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -</html>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -HTML;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$response = React\Http\Message\Response::html($html);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is a convenient shortcut method that returns the equivalent of this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'Content-Type' => 'text/html; charset=utf-8'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $html
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method always returns a response with a 200 OK status code and -the appropriate Content-Type response header for the given HTTP source -string encoded in UTF-8 (Unicode). It's generally recommended to end the -given plaintext string with a trailing newline.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to use a different status code or custom HTTP response -headers, you can manipulate the returned response object using the -provided PSR-7 methods or directly instantiate a custom HTTP response -object using the Response constructor:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = React\Http\Message\Response::html(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    "<h1>Error</h1>\n<p>Invalid user name given.</p>\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -)->withStatus(React\Http\Message\Response::STATUS_BAD_REQUEST);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                json()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The static json(mixed $data): Response method can be used to -create a JSON response.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = React\Http\Message\Response::json(['name' => 'Alice']);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is a convenient shortcut method that returns the equivalent of this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'Content-Type' => 'application/json'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    json_encode(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        ['name' => 'Alice'],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRESERVE_ZERO_FRACTION
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ) . "\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method always returns a response with a 200 OK status code and -the appropriate Content-Type response header for the given structured -data encoded as a JSON text.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The given structured data will be encoded as a JSON text. Any string -values in the data must be encoded in UTF-8 (Unicode). If the encoding -fails, this method will throw an InvalidArgumentException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, the given structured data will be encoded with the flags as -shown above. This includes pretty printing (PHP 5.4+) and preserving -zero fractions for float values (PHP 5.6.6+) to ease debugging. It is -assumed any additional data overhead is usually compensated by using HTTP -response compression.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to use a different status code or custom HTTP response -headers, you can manipulate the returned response object using the -provided PSR-7 methods or directly instantiate a custom HTTP response -object using the Response constructor:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = React\Http\Message\Response::json(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ['error' => 'Invalid user name given']
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -)->withStatus(React\Http\Message\Response::STATUS_BAD_REQUEST);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                plaintext()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The static plaintext(string $text): Response method can be used to -create a plaintext response.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = React\Http\Message\Response::plaintext("Hello wörld!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is a convenient shortcut method that returns the equivalent of this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'Content-Type' => 'text/plain; charset=utf-8'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    "Hello wörld!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method always returns a response with a 200 OK status code and -the appropriate Content-Type response header for the given plaintext -string encoded in UTF-8 (Unicode). It's generally recommended to end the -given plaintext string with a trailing newline.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to use a different status code or custom HTTP response -headers, you can manipulate the returned response object using the -provided PSR-7 methods or directly instantiate a custom HTTP response -object using the Response constructor:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    "Error: Invalid user name given.\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -)->withStatus(React\Http\Message\Response::STATUS_BAD_REQUEST);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                xml()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The static xml(string $xml): Response method can be used to -create an XML response.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $xml = <<<XML
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -<?xml version="1.0" encoding="utf-8"?>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -<body>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    <greeting>Hello wörld!</greeting>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -</body>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -XML;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$response = React\Http\Message\Response::xml($xml);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is a convenient shortcut method that returns the equivalent of this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'Content-Type' => 'application/xml'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $xml
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This method always returns a response with a 200 OK status code and -the appropriate Content-Type response header for the given XML source -string. It's generally recommended to use UTF-8 (Unicode) and specify -this as part of the leading XML declaration and to end the given XML -source string with a trailing newline.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to use a different status code or custom HTTP response -headers, you can manipulate the returned response object using the -provided PSR-7 methods or directly instantiate a custom HTTP response -object using the Response constructor:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $response = React\Http\Message\Response::xml(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    "<error><message>Invalid user name given.</message></error>\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -)->withStatus(React\Http\Message\Response::STATUS_BAD_REQUEST);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Request

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Http\Message\Request class can be used to -respresent an outgoing HTTP request message.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This class implements the -PSR-7 RequestInterface -which extends the -PSR-7 MessageInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is mostly used internally to represent each outgoing HTTP request -message for the HTTP client implementation. Likewise, you can also use this -class with other HTTP client implementations and for tests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internally, this implementation builds on top of a base class which is -considered an implementation detail that may change in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ServerRequest

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Http\Message\ServerRequest class can be used to -respresent an incoming server request message.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This class implements the -PSR-7 ServerRequestInterface -which extends the -PSR-7 RequestInterface -which in turn extends the -PSR-7 MessageInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is mostly used internally to represent each incoming request message. -Likewise, you can also use this class in test cases to test how your web -application reacts to certain HTTP requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internally, this implementation builds on top of a base class which is -considered an implementation detail that may change in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Uri

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Http\Message\Uri class can be used to -respresent a URI (or URL).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This class implements the -PSR-7 UriInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This is mostly used internally to represent the URI of each HTTP request -message for our HTTP client and server implementations. Likewise, you may -also use this class with other HTTP implementations and for tests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ResponseException

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Http\Message\ResponseException is an Exception sub-class that will be used to reject -a request promise if the remote server returns a non-success status code -(anything but 2xx or 3xx). -You can control this behavior via the withRejectErrorResponse() method.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The getCode(): int method can be used to -return the HTTP response status code.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The getResponse(): ResponseInterface method can be used to -access its underlying response object.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                React\Http\Middleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                StreamingRequestMiddleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Http\Middleware\StreamingRequestMiddleware can be used to -process incoming requests with a streaming request body (without buffering).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This allows you to process requests of any size without buffering the request -body in memory. Instead, it will represent the request body as a -ReadableStreamInterface -that emit chunks of incoming data as it is received:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        $body = $request->getBody();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        assert($body instanceof Psr\Http\Message\StreamInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        assert($body instanceof React\Stream\ReadableStreamInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return new React\Promise\Promise(function ($resolve) use ($body) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            $bytes = 0;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            $body->on('data', function ($chunk) use (&$bytes) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -                $bytes += \count($chunk);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            $body->on('close', function () use (&$bytes, $resolve) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -                $resolve(new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -                    React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -                    [],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -                    "Received $bytes bytes\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -                ));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also streaming incoming request -for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Additionally, this middleware can be used in combination with the -LimitConcurrentRequestsMiddleware and -RequestBodyBufferMiddleware (see below) -to explicitly configure the total number of requests that can be handled at -once:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyBufferMiddleware(2 * 1024 * 1024), // 2 MiB per request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyParserMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Internally, this class is used as a "marker" to not trigger the default -request buffering behavior in the HttpServer. It does not implement any logic -on its own.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                LimitConcurrentRequestsMiddleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Http\Middleware\LimitConcurrentRequestsMiddleware can be used to +Promise like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    function (ServerRequestInterface $request, callable $next) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        $promise = new React\Promise\Promise(function ($resolve) use ($next, $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            $resolve($next($request));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return $promise->then(null, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +                500,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +                array(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +                'Internal error: ' . $e->getMessage()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        if (mt_rand(0, 1) === 1) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            throw new RuntimeException('Database error');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return new Response(200);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +LimitConcurrentRequestsMiddleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The LimitConcurrentRequestsMiddleware can be used to limit how many next handlers can be executed concurrently.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                If this middleware is invoked, it will check if the number of pending handlers is below the allowed limit and then simply invoke the next handler @@ -2424,33 +1022,32 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                                resumed).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The following example shows how this middleware can be used to ensure no more than 10 handlers will be invoked at once:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\LimitConcurrentRequestsMiddleware(10),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new LimitConcurrentRequestsMiddleware(10),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +));

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Similarly, this middleware is often used in combination with the RequestBodyBufferMiddleware (see below) to limit the total number of requests that can be buffered at once:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyBufferMiddleware(2 * 1024 * 1024), // 2 MiB per request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyParserMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new StreamingServer(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new RequestBodyBufferMiddleware(2 * 1024 * 1024), // 2 MiB per request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new RequestBodyParserMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +));

                                                                                                                                                                                                                                                                                                                                                                                                                                                                More sophisticated examples include limiting the total number of requests that can be buffered at once and then ensure the actual request handler only processes one request after another without any concurrency:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyBufferMiddleware(2 * 1024 * 1024), // 2 MiB per request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyParserMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\LimitConcurrentRequestsMiddleware(1), // only execute 1 handler (no concurrency)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                RequestBodyBufferMiddleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                One of the built-in middleware is the React\Http\Middleware\RequestBodyBufferMiddleware which +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new StreamingServer(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new RequestBodyBufferMiddleware(2 * 1024 * 1024), // 2 MiB per request
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new RequestBodyParserMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new LimitConcurrentRequestsMiddleware(1), // only execute 1 handler (no concurrency)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +RequestBodyBufferMiddleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                One of the built-in middleware is the RequestBodyBufferMiddleware which can be used to buffer the whole incoming request body in memory. This can be useful if full PSR-7 compatibility is needed for the request handler and the default streaming request body handling is not needed. @@ -2484,17 +1081,17 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                                LimitConcurrentRequestsMiddleware (see above) to limit the total number of concurrent requests.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Usage:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyBufferMiddleware(16 * 1024 * 1024), // 16 MiB
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // The body from $request->getBody() is now fully available without the need to stream it 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return new React\Http\Message\Response(React\Http\Message\Response::STATUS_OK);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                RequestBodyParserMiddleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Http\Middleware\RequestBodyParserMiddleware takes a fully buffered request body +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new StreamingServer(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new RequestBodyBufferMiddleware(16 * 1024 * 1024), // 16 MiB
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // The body from $request->getBody() is now fully available without the need to stream it 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return new Response(200);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +RequestBodyParserMiddleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The RequestBodyParserMiddleware takes a fully buffered request body (generally from RequestBodyBufferMiddleware), and parses the form values and file uploads from the incoming HTTP request body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This middleware handler takes care of applying values from HTTP @@ -2504,60 +1101,58 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instead of relying on these superglobals, you can use the $request->getParsedBody() and $request->getUploadedFiles() methods as defined by PSR-7.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Accordingly, each file upload will be represented as instance implementing the -PSR-7 UploadedFileInterface. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Accordingly, each file upload will be represented as instance implementing UploadedFileInterface. Due to its blocking nature, the moveTo() method is not available and throws a RuntimeException instead. You can use $contents = (string)$file->getStream(); to access the file contents and persist this to your favorite data store.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $handler = function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // If any, parsed form fields are now available from $request->getParsedBody()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $body = $request->getParsedBody();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $name = isset($body['name']) ? $body['name'] : 'unnamed';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $files = $request->getUploadedFiles();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $avatar = isset($files['avatar']) ? $files['avatar'] : null;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    if ($avatar instanceof Psr\Http\Message\UploadedFileInterface) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        if ($avatar->getError() === UPLOAD_ERR_OK) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            $uploaded = $avatar->getSize() . ' bytes';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        } elseif ($avatar->getError() === UPLOAD_ERR_INI_SIZE) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            $uploaded = 'file too large';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            $uploaded = 'with error';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        $uploaded = 'nothing';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    return new React\Http\Message\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        React\Http\Message\Response::STATUS_OK,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -            'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -        $name . ' uploaded ' . $uploaded
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -$http = new React\Http\HttpServer(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\StreamingRequestMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyBufferMiddleware(16 * 1024 * 1024), // 16 MiB
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    new React\Http\Middleware\RequestBodyParserMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also form upload server example for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $handler = function (ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // If any, parsed form fields are now available from $request->getParsedBody()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $body = $request->getParsedBody();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $name = isset($body['name']) ? $body['name'] : 'unnamed';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $files = $request->getUploadedFiles();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $avatar = isset($files['avatar']) ? $files['avatar'] : null;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    if ($avatar instanceof UploadedFileInterface) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        if ($avatar->getError() === UPLOAD_ERR_OK) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            $uploaded = $avatar->getSize() . ' bytes';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        } elseif ($avatar->getError() === UPLOAD_ERR_INI_SIZE) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            $uploaded = 'file too large';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            $uploaded = 'with error';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        $uploaded = 'nothing';
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    return new Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +            'Content-Type' => 'text/plain'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +        $name . ' uploaded ' . $uploaded
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server = new StreamingServer(array((
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new LimitConcurrentRequestsMiddleware(100), // 100 concurrent buffering handlers
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new RequestBodyBufferMiddleware(16 * 1024 * 1024), // 16 MiB
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    new RequestBodyParserMiddleware(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also example #12 for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, this middleware respects the -upload_max_filesize +upload_max_filesize (default 2M) ini setting. Files that exceed this limit will be rejected with an UPLOAD_ERR_INI_SIZE error. You can control the maximum filesize for each individual file upload by explicitly passing the maximum filesize in bytes as the first parameter to the constructor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                new React\Http\Middleware\RequestBodyParserMiddleware(8 * 1024 * 1024); // 8 MiB limit per file
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                new RequestBodyParserMiddleware(8 * 1024 * 1024); // 8 MiB limit per file

                                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, this middleware respects the -file_uploads +file_uploads (default 1) and -max_file_uploads +max_file_uploads (default 20) ini settings. These settings control if any and how many files can be uploaded in a single request. If you upload more files in a single request, additional files will be ignored @@ -2565,7 +1160,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that upload fields left blank on submission do not count towards this limit. You can control the maximum number of file uploads per request by explicitly passing the second parameter to the constructor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                new React\Http\Middleware\RequestBodyParserMiddleware(10 * 1024, 100); // 100 files with 10 KiB each
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                new RequestBodyParserMiddleware(10 * 1024, 100); // 100 files with 10 KiB each

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that this middleware handler simply parses everything that is already buffered in the request body. @@ -2586,41 +1181,64 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                HTTP

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This middleware respects the -max_input_vars +max_input_vars (default 1000) and -max_input_nesting_level +max_input_nesting_level (default 64) ini settings.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that this middleware ignores the -enable_post_data_reading +enable_post_data_reading (default 1) ini setting because it makes little sense to respect here and is left up to higher-level implementations. If you want to respect this setting, you have to check its value and effectively avoid using this middleware entirely.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Third-Party Middleware

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                While this project does provide the means to use middleware implementations +(see above), it does not aim to define how middleware implementations should +look like. We realize that there's a vivid ecosystem of middleware +implementations and ongoing effort to standardize interfaces between these with +PSR-15 (HTTP Server Request Handlers) +and support this goal. +As such, this project only bundles a few middleware implementations that are +required to match PHP's request behavior (see above) and otherwise actively +encourages third-party middleware implementations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                While we would love to support PSR-15 directy in react/http, we understand +that this interface does not specifically target async APIs and as such does +not take advantage of promises for deferred responses. +The gist of this is that where PSR-15 enforces a ResponseInterface return +value, we also accept a PromiseInterface<ResponseInterface>. +As such, we suggest using the external +PSR-15 middleware adapter +that uses on the fly monkey patching of these return values which makes using +most PSR-15 middleware possible with this package without any changes required.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Other than that, you can also use the above middleware definition +to create custom middleware. A non-exhaustive list of third-party middleware can +be found at the middleware wiki. +If you build or know a custom middleware, make sure to let the world know and +feel free to add it to this list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This project follows SemVer. -This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                composer require react/http:^1.11
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer require react/http:^0.8.3

                                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.3 through current PHP 8+ and +extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. -It's highly recommended to use the latest supported PHP version for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +It's highly recommended to use PHP 7+ for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer install

                                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The test suite also contains a number of functional integration tests that rely -on a stable internet connection. -If you do not want to run these, they can simply be skipped like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                vendor/bin/phpunit --exclude-group internet
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                $ php vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +License

                                                                                                                                                                                                                                                                                                                                                                                                                                                                MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -219,8 +201,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP License

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The MIT License (MIT)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Copyright (c) 2012 Christian Lück, Cees-Jan Kiewiet, Jan Sorgalla, Chris Boden, Igor Wiedler

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Copyright (c) 2012 Igor Wiedler, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -243,8 +224,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              HTTP
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              diff --git a/index.html b/index.html index 6bc590aa1..78780d8b1 100644 --- a/index.html +++ b/index.html @@ -20,20 +20,20 @@ - - + + - - - + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -130,7 +135,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS - v1.14.0 + v0.4.15 @@ -144,7 +149,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Cache - v1.2.0 + v0.5.0 @@ -153,7 +158,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              ChildProcess - v0.6.7 + v0.5.2 @@ -162,7 +167,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseTimer - v1.11.0 + v1.5.0 @@ -171,30 +176,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -222,7 +204,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Event-driven, non-blocking I/O with PHP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -233,24 +215,23 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Event-driven, non-blocking I/O with PHP

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              <?php
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -// $ composer require react/http react/socket # install example using Composer
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -// $ php example.php # run example on command line, requires no additional web server
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -require __DIR__ . '/vendor/autoload.php';
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    return React\Http\Message\Response::plaintext(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -        "Hello World!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$socket = new React\Socket\SocketServer('127.0.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -$http->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -echo "Server running at http://127.0.0.1:8080" . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This simple web server written in ReactPHP responds with "Hello World!" for every request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$server = new React\Http\Server(function (Psr\Http\Message\ServerRequestInterface $request) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    return new React\Http\Response(
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        array('Content-Type' => 'text/plain'),
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +        "Hello World!\n"
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$socket = new React\Socket\Server(8080, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$server->listen($socket);
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +echo "Server running at http://127.0.0.1:8080\n";
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                              This simple web server written in ReactPHP responds with "Hello World" for every request.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -284,8 +265,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Event-driven, non-blocking I/O with PHP

                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Rock-solid with stable long-term support (LTS) releases.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Requires no extensions and runs on any platform - no excuses!
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Takes advantage of optional extensions to get better performance when available.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Supports latest version of PHP 8+ and PHP 7+ for best performance and support.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Still supports legacy PHP 5.3+ and HHVM for maximum compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Highly recommends latest version of PHP 7+ for best performance and support.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Supports legacy PHP 5.3+ and HHVM for maximum compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Well designed and reusable components.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Decoupled parts so they can be replaced by alternate implementations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Carefully tested (unit & functional).
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -318,7 +299,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Core Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - + + + -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -708,64 +667,6 @@


                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - Get to know the people behind ReactPHP -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - We're a small core team of professionals. We help manage, maintain and steer the project.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - But ReactPHP isn't just us. - We're proudly supported by a large network of outside contributors from all over the world. -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -789,8 +690,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Please do not hesitate to file your question as an issue in the relevant component so others can also participate.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - You can find our official channel at reactphp/reactphp on Gitter.im. - Many of us are available in this channel, so many questions get answered in a few minutes to some hours. We also use this channel to announce all new releases and ongoing development efforts. + Check out #reactphp on irc.freenode.net. You can use the Webchat if you don't already use an IRC client. + Many of us are available in this channel, so many questions get answered in a few minutes to some hours. We also use this channel to announce all new releases and ongoing development efforts, so consider setting up an IRC client and idling in this channel for a little longer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Also follow @reactphp on Twitter for updates. We use this mostly for noteworthy, bigger updates and to keep the community updated about ongoing development efforts. @@ -821,7 +722,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              diff --git a/promise-stream/changelog.html b/promise-stream/changelog.html index a37255941..83a9c0ac7 100644 --- a/promise-stream/changelog.html +++ b/promise-stream/changelog.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -41,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -221,215 +203,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseStream Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - 2023 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.7.0 - - - (2023-12-13) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Full PHP 8.3 compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#39 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Update test suite and collect all garbage cycles.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#38 and #39 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.6.0 - - - (2023-07-07) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Update unwrapped stream to avoid unhandled promise rejections.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#37 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Improve first() promise resolution to clean up any garbage references.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#36 by @lucasnetau)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite and project setup and report failed assertions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#34 by @clue and #35 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - 2022 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.5.0 - - - (2022-09-09) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Full support for PHP 8.2 release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#33 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite and minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#32 by @clue and #31 by @nhedger)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.4.0 - - - (2022-06-20) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Forward compatibility with react/promise 3.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#20 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite, test against PHP 8.1 and fix legacy HHVM build.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#28, #29 and #30 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - 2021 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.3.0 - - - (2021-10-18) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Improve error reporting by appending previous exception messages.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#26 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                For most common use cases this means that simply reporting the Exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -message should give the most relevant details for any issues:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                React\Promise\Stream\buffer($stream)->then(function (string $contents) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // …
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error:' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve documentation, describe promise and stream data types.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#27 by @clue and #23 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite and add .gitattributes to exclude dev files from exports.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -Use GitHub actions for continuous integration (CI) and run tests on PHPUnit 9 and PHP 8.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#21 by @reedy and #22, #24 and #25 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - 2019 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - - - 1.2.0 - - - (2019-07-03) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Support unwrapping object streams by buffering original write chunks in array.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#15 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Clean up unneeded references for unwrapped streams when closing.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#18 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Writing to closed unwrapped stream should return false (backpressure).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#17 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite to support PHPUnit 7, PHP 7.3 and fix incomplete test
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -and improve API documentation.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#16 and #19 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                              2017

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -448,16 +225,16 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix all() to assume null values if no event data is passed
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#13 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix all() to assume null values if no event data is passed
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#13 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  add forward compatibility with PHPUnit 5 and PHPUnit 6 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  test against PHP 7.1 and 7.2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#11 and #12 by @clue and #9 by @carusogabriel)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#11 and #12 by @clue and #9 by @carusogabriel)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -476,18 +253,18 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Reject first() when stream emits an error event
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#7 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Reject first() when stream emits an error event
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#7 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Explicit close() of unwrapped stream should not emit error event
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#8 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Explicit close() of unwrapped stream should not emit error event
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#8 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Internal refactoring to simplify buffer() function
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#6 by @kelunik)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Internal refactoring to simplify buffer() function
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#6 by @kelunik)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -506,11 +283,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • First stable release, now following SemVer
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Contains no other changes, so it's actually fully compatible with the v0.1.2 release.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Contains no other changes, so it's actually fully compatible with the v0.1.2 release.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -528,9 +305,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: Optional maximum buffer length for buffer() (#3 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Improvement: Readme improvements (#5 by @jsor)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Feature: Optional maximum buffer length for buffer() (#3 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Improvement: Readme improvements (#5 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -548,8 +325,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Improvement: Forward compatibility with stream 1.0, 0.7, 0.6, and 0.5 (#2 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Improvement: Forward compatibility with stream 1.0, 0.7, 0.6, and 0.5 (#2 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -567,8 +344,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Initial release, adapted from clue/promise-stream-react
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -588,8 +365,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          diff --git a/promise-stream/index.html b/promise-stream/index.html index 1284dd9a0..515ae5c8b 100644 --- a/promise-stream/index.html +++ b/promise-stream/index.html @@ -5,7 +5,8 @@ - PromiseStream - ReactPHP + PromiseStream: +PromiseStream - ReactPHP @@ -20,13 +21,13 @@ - - + + - - - + + + @@ -40,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                              PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Install
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Tests
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • License
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This lightweight library consists only of a few simple functions. All functions reside under the React\Promise\Stream namespace.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The below examples refer to all functions with their fully-qualified names like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          React\Promise\Stream\buffer(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          As of PHP 5.6+ you can also import each required function into your code like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          use function React\Promise\Stream\buffer;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -buffer(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Alternatively, you can also use an import statement similar to this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          use React\Promise\Stream;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -Stream\buffer(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          buffer()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The buffer(ReadableStreamInterface<string> $stream, ?int $maxLength = null): PromiseInterface<string> function can be used to -create a Promise which will be fulfilled with the stream data buffer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $stream = accessSomeJsonStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -React\Promise\Stream\buffer($stream)->then(function (string $contents) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    var_dump(json_decode($contents));
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be fulfilled with a string of all data chunks concatenated once the stream closes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be fulfilled with an empty string if the stream is already closed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be rejected with a RuntimeException if the stream emits an error.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be rejected with a RuntimeException if it is cancelled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The optional $maxLength argument defaults to no limit. In case the maximum -length is given and the stream emits more data before the end, the promise -will be rejected with an OverflowException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $stream = accessSomeToLargeStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -React\Promise\Stream\buffer($stream, 1024)->then(function ($contents) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    var_dump(json_decode($contents));
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -}, function ($error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    // Reaching here when the stream buffer goes above the max size,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    // in this example that is 1024 bytes,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    // or when the stream emits an error.
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          first()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The first(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface<mixed> function can be used to -create a Promise which will be fulfilled once the given event triggers for the first time.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $stream = accessSomeJsonStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -React\Promise\Stream\first($stream)->then(function (string $chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    echo 'The first chunk arrived: ' . $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be fulfilled with a mixed value of whatever the first event -emitted or null if the event does not pass any data. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The below examples assume you use an import statement similar to this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          use React\Promise\Stream;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Stream\buffer(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Alternatively, you can also refer to them with their fully-qualified name:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          \React\Promise\Stream\buffer(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +buffer()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The buffer(ReadableStreamInterface $stream, int $maxLength = null) function can be used to create +a Promise which resolves with the stream data buffer. With an optional maximum length argument +which defaults to no limit. In case the maximum length is reached before the end the promise will +be rejected with a \OverflowException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $stream = accessSomeJsonStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Stream\buffer($stream)->then(function ($contents) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    var_dump(json_decode($contents));
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will resolve with all data chunks concatenated once the stream closes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will resolve with an empty string if the stream is already closed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will reject if the stream emits an error.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will reject if it is canceled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $stream = accessSomeToLargeStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Stream\buffer($stream, 1024)->then(function ($contents) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    var_dump(json_decode($contents));
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +}, function ($error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    // Reaching here when the stream buffer goes above the max size,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    // in this example that is 1024 bytes,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    // or when the stream emits an error. 
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +first()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The first(ReadableStreamInterface|WritableStreamInterface $stream, $event = 'data') +function can be used to create a Promise which resolves once the given event triggers for the first time.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $stream = accessSomeJsonStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Stream\first($stream)->then(function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    echo 'The first chunk arrived: ' . $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will resolve with whatever the first event emitted or null if the +event does not pass any data. If you do not pass a custom event name, then it will wait for the first "data" -event. -For common streams of type ReadableStreamInterface<string>, this means it will be -fulfilled with a string containing the first data chunk.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be rejected with a RuntimeException if the stream emits an error -– unless you're waiting for the "error" event, in which case it will be fulfilled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be rejected with a RuntimeException once the stream closes -– unless you're waiting for the "close" event, in which case it will be fulfilled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be rejected with a RuntimeException if the stream is already closed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be rejected with a RuntimeException if it is cancelled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          all()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The all(ReadableStreamInterface|WritableStreamInterface $stream, string $event = 'data'): PromiseInterface<array> function can be used to -create a Promise which will be fulfilled with an array of all the event data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $stream = accessSomeJsonStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -React\Promise\Stream\all($stream)->then(function (array $chunks) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    echo 'The stream consists of ' . count($chunks) . ' chunk(s)';
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be fulfilled with an array once the stream closes. The array -will contain whatever all events emitted or null values if the events do not pass any data. +event and resolve with a string containing the first data chunk.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will reject if the stream emits an error – unless you're waiting for +the "error" event, in which case it will resolve.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will reject once the stream closes – unless you're waiting for the +"close" event, in which case it will resolve.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will reject if the stream is already closed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will reject if it is canceled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +all()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The all(ReadableStreamInterface|WritableStreamInterface $stream, $event = 'data') +function can be used to create a Promise which resolves with an array of all the event data.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $stream = accessSomeJsonStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Stream\all($stream)->then(function ($chunks) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    echo 'The stream consists of ' . count($chunks) . ' chunk(s)';
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will resolve with an array of whatever all events emitted or null if the +events do not pass any data. If you do not pass a custom event name, then it will wait for all the "data" -events. -For common streams of type ReadableStreamInterface<string>, this means it will be -fulfilled with a string[] array containing all the data chunk.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be fulfilled with an empty array if the stream is already closed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be rejected with a RuntimeException if the stream emits an error.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will be rejected with a RuntimeException if it is cancelled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          unwrapReadable()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The unwrapReadable(PromiseInterface<ReadableStreamInterface<T>> $promise): ReadableStreamInterface<T> function can be used to -unwrap a Promise which will be fulfilled with a ReadableStreamInterface<T>.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This function returns a readable stream instance (implementing ReadableStreamInterface<T>) +events and resolve with an array containing all the data chunks.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will resolve with an array once the stream closes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will resolve with an empty array if the stream is already closed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will reject if the stream emits an error.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The promise will reject if it is canceled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +unwrapReadable()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The unwrapReadable(PromiseInterface $promise) function can be used to unwrap +a Promise which resolves with a ReadableStreamInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This function returns a readable stream instance (implementing ReadableStreamInterface) right away which acts as a proxy for the future promise resolution. -Once the given Promise will be fulfilled with a ReadableStreamInterface<T>, its -data will be piped to the output stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          //$promise = someFunctionWhichResolvesWithAStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$promise = startDownloadStream($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream = React\Promise\Stream\unwrapReadable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream->on('data', function (string $data) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    echo $data;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    echo 'DONE';
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Once the given Promise resolves with a ReadableStreamInterface, its data will +be piped to the output stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          //$promise = someFunctionWhichResolvesWithAStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$promise = startDownloadStream($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream = Stream\unwrapReadable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream->on('data', function ($data) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +   echo $data;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +   echo 'DONE';
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                          If the given promise is either rejected or fulfilled with anything but an instance of ReadableStreamInterface, then the output stream will emit an error event and close:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = startDownloadStream($invalidUri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream = React\Promise\Stream\unwrapReadable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream->on('error', function (Exception $error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    echo 'Error: ' . $error->getMessage();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = startDownloadStream($invalidUri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream = Stream\unwrapReadable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream->on('error', function (Exception $error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    echo 'Error: ' . $error->getMessage();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The given $promise SHOULD be pending, i.e. it SHOULD NOT be fulfilled or rejected at the time of invoking this function. -If the given promise is already settled and does not fulfill with an instance of -ReadableStreamInterface, then you will not be able to receive the error event.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +If the given promise is already settled and does not resolve with an +instance of ReadableStreamInterface, then you will not be able to receive +the error event.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          You can close() the resulting stream at any time, which will either try to cancel() the pending promise or try to close() the underlying stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = startDownloadStream($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream = React\Promise\Stream\unwrapReadable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$loop->addTimer(2.0, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          unwrapWritable()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The unwrapWritable(PromiseInterface<WritableStreamInterface<T>> $promise): WritableStreamInterface<T> function can be used to -unwrap a Promise which will be fulfilled with a WritableStreamInterface<T>.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This function returns a writable stream instance (implementing WritableStreamInterface<T>) +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = startDownloadStream($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream = Stream\unwrapReadable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$loop->addTimer(2.0, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +unwrapWritable()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The unwrapWritable(PromiseInterface $promise) function can be used to unwrap +a Promise which resolves with a WritableStreamInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This function returns a writable stream instance (implementing WritableStreamInterface) right away which acts as a proxy for the future promise resolution. -Any writes to this instance will be buffered in memory for when the promise will -be fulfilled. -Once the given Promise will be fulfilled with a WritableStreamInterface<T>, any -data you have written to the proxy will be forwarded transparently to the inner -stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          //$promise = someFunctionWhichResolvesWithAStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$promise = startUploadStream($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream = React\Promise\Stream\unwrapWritable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream->write('hello');
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream->end('world');
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    echo 'DONE';
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Once the given Promise resolves with a WritableStreamInterface, any data you +wrote to the proxy will be piped to the inner stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          //$promise = someFunctionWhichResolvesWithAStream();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$promise = startUploadStream($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream = Stream\unwrapWritable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream->write('hello');
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream->end('world');
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +   echo 'DONE';
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                          If the given promise is either rejected or fulfilled with anything but an instance of WritableStreamInterface, then the output stream will emit an error event and close:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = startUploadStream($invalidUri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream = React\Promise\Stream\unwrapWritable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream->on('error', function (Exception $error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    echo 'Error: ' . $error->getMessage();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = startUploadStream($invalidUri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream = Stream\unwrapWritable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream->on('error', function (Exception $error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    echo 'Error: ' . $error->getMessage();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The given $promise SHOULD be pending, i.e. it SHOULD NOT be fulfilled or rejected at the time of invoking this function. -If the given promise is already settled and does not fulfill with an instance of -WritableStreamInterface, then you will not be able to receive the error event.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +If the given promise is already settled and does not resolve with an +instance of WritableStreamInterface, then you will not be able to receive +the error event.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          You can close() the resulting stream at any time, which will either try to cancel() the pending promise or try to close() the underlying stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = startUploadStream($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$stream = React\Promise\Stream\unwrapWritable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$loop->addTimer(2.0, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The recommended way to install this library is through Composer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = startUploadStream($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$stream = Stream\unwrapWritable($promise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$loop->addTimer(2.0, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This project follows SemVer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This project follows SemVer. This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          composer require react/promise-stream:^1.7
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $ composer require react/promise-stream:^1.1.1

                                                                                                                                                                                                                                                                                                                                                                                                                                                          See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.3 through current PHP 8+ and +extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. -It's highly recommended to use the latest supported PHP version for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          License

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +It's highly recommended to use PHP 7+ for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +License

                                                                                                                                                                                                                                                                                                                                                                                                                                                          MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                                                        + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -220,7 +202,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream License

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The MIT License (MIT)

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Copyright (c) 2016 Christian Lück, Cees-Jan Kiewiet, Jan Sorgalla, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Copyright (c) 2016 Christian Lück

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -243,8 +225,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          diff --git a/promise-timer/changelog.html b/promise-timer/changelog.html index 5127e7c6a..28b91450a 100644 --- a/promise-timer/changelog.html +++ b/promise-timer/changelog.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -41,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -221,12 +203,6 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2024 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.11.0 - - - (2024-06-04) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#70 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Full PHP 8.3 compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#68 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2023 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.10.0 - - - (2023-07-20) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2022 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.9.0 - - - (2022-06-13) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Improve forward compatibility with upcoming Promise v3 API.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#54 and #55 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Minor documentation improvements for upcoming Promise v3.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#58 by @clue and #56 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite, fix legacy HHVM build by downgrading Composer.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#57 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2021 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.8.0 - - - (2021-12-06) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Add new sleep() function and deprecate resolve() and reject() functions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#51 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            // deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -React\Promise\Timer\resolve($time);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -React\Promise\Timer\reject($time);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -React\Promise\Timer\sleep($time);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support PHP 8.1 release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#50 by @Thomas-Gelf, #52 by @clue and #48 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve API documentation and add parameter types and return types.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#49 by @clue and #47 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.7.0 - - - (2021-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Simplify usage by supporting new default loop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#46 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (still supported)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise = timeout($promise, $time, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise = resolve($time, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise = reject($time, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// new (using default loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise = timeout($promise, $time);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise = resolve($time);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise = reject($time);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite, use GitHub actions for continuous integration (CI),
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -update PHPUnit config, run tests on PHP 8 and add full core team to the license.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#43 by @WyriHaximus, #44 and #45 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2020 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.6.0 - - - (2020-07-10) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2019 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.5.1 - - - (2019-03-27) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Typo in readme
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#35 by @aak74)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improvement: Only include functions file when functions aren't defined
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#36 by @Niko9911)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          2018

                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -494,9 +228,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Feature: Improve memory consumption by cleaning up garbage references to pending promise without canceller.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#34 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +(#34 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -514,9 +248,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: Improve memory consumption by cleaning up garbage references.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#33 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +(#33 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -534,9 +268,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Improve memory consumption by cleaning up unneeded references.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#32 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +(#32 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -559,15 +293,15 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    README improvements
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#28 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    README improvements
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#28 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve test suite by adding forward compatiblity with PHPUnit 6 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve test suite by adding forward compatiblity with PHPUnit 6 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    fix test suite forward compatibility with upcoming EventLoop releases
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#30 and #31 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#30 and #31 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -586,24 +320,24 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Only start timers if input Promise is still pending and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Only start timers if input Promise is still pending and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      return a settled output promise if the input is already settled.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#25 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#25 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Cap minimum timer interval at 1µs across all versions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#23 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Cap minimum timer interval at 1µs across all versions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#23 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Forward compatibility with EventLoop v1.0 and v0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#27 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Forward compatibility with EventLoop v1.0 and v0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#27 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite by adding PHPUnit to require-dev and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite by adding PHPUnit to require-dev and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      lock Travis distro so new defaults will not break the build
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#24 and #26 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#24 and #26 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -627,9 +361,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Improve test suite to use PSR-4 autoloader and proper namespaces.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#21 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +(#21 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -647,9 +381,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Feature: Support promise cancellation for all timer primitives
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#18 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +(#18 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -672,7 +406,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -693,8 +427,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          diff --git a/promise-timer/index.html b/promise-timer/index.html index cfe9df4b7..f6f2eb27c 100644 --- a/promise-timer/index.html +++ b/promise-timer/index.html @@ -5,7 +5,8 @@ - PromiseTimer - ReactPHP + PromiseTimer: +PromiseTimer - ReactPHP @@ -20,13 +21,13 @@ - - + + - - - + + + @@ -40,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -219,239 +202,299 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          CI status -installs on Packagist

                                                                                                                                                                                                                                                                                                                                                                                                                                                          + +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Build Status

                                                                                                                                                                                                                                                                                                                                                                                                                                                          A trivial implementation of timeouts for Promises, built on top of ReactPHP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Table of contents

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This lightweight library consists only of a few simple functions. All functions reside under the React\Promise\Timer namespace.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The below examples refer to all functions with their fully-qualified names like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          React\Promise\Timer\timeout(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          As of PHP 5.6+ you can also import each required function into your code like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          use function React\Promise\Timer\timeout;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -timeout(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Alternatively, you can also use an import statement similar to this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          use React\Promise\Timer;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -Timer\timeout(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          timeout()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The timeout(PromiseInterface<T> $promise, float $time, ?LoopInterface $loop = null): PromiseInterface<T> function can be used to -cancel operations that take too long.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          You need to pass in an input $promise that represents a pending operation -and timeout parameters. It returns a new promise with the following -resolution behavior:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The below examples assume you use an import statement similar to this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          use React\Promise\Timer;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Timer\timeout(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Alternatively, you can also refer to them with their fully-qualified name:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          \React\Promise\Timer\timeout(…);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +timeout()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The timeout(PromiseInterface $promise, $time, LoopInterface $loop) function +can be used to cancel operations that take too long. +You need to pass in an input $promise that represents a pending operation and timeout parameters. +It returns a new Promise with the following resolution behavior:

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            If the input $promise resolves before $time seconds, resolve the -resulting promise with its fulfillment value.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            If the input $promise rejects before $time seconds, reject the -resulting promise with its rejection value.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            If the input $promise does not settle before $time seconds, cancel -the operation and reject the resulting promise with a TimeoutException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • If the input $promise resolves before $time seconds, resolve the resulting promise with its fulfillment value.
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • If the input $promise rejects before $time seconds, reject the resulting promise with its rejection value.
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • If the input $promise does not settle before $time seconds, cancel the operation and reject the resulting promise with a TimeoutException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Internally, the given $time value will be used to start a timer that will -cancel the pending operation once it triggers. This implies that if you -pass a really small (or negative) value, it will still start a timer and will -thus trigger at the earliest possible time in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +cancel the pending operation once it triggers. +This implies that if you pass a really small (or negative) value, it will still +start a timer and will thus trigger at the earliest possible time in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          If the input $promise is already settled, then the resulting promise will resolve or reject immediately without starting a timer at all.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This function takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use. You can use a null value here in order to -use the default loop. This value -SHOULD NOT be given unless you're sure you want to explicitly use a given event -loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          A common use case for handling only resolved values looks like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = accessSomeRemoteResource();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -React\Promise\Timer\timeout($promise, 10.0)->then(function ($value) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    // the operation finished within 10.0 seconds
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = accessSomeRemoteResource();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Timer\timeout($promise, 10.0, $loop)->then(function ($value) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    // the operation finished within 10.0 seconds
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                          A more complete example could look like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = accessSomeRemoteResource();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -React\Promise\Timer\timeout($promise, 10.0)->then(
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    function ($value) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -        // the operation finished within 10.0 seconds
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    function ($error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -        if ($error instanceof React\Promise\Timer\TimeoutException) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -            // the operation has failed due to a timeout
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -        } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -            // the input operation has failed due to some other error
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Or if you're using react/promise v3:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          React\Promise\Timer\timeout($promise, 10.0)->then(function ($value) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    // the operation finished within 10.0 seconds
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -})->catch(function (React\Promise\Timer\TimeoutException $error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    // the operation has failed due to a timeout
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -})->catch(function (Throwable $error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    // the input operation has failed due to some other error
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          As discussed above, the timeout() function will take care of -the underlying operation if it takes too long. In this case, you can be -sure the resulting promise will always be rejected with a -TimeoutException. On top of this, the function will -try to cancel the underlying operation. Responsibility for this -cancellation logic is left up to the underlying operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = accessSomeRemoteResource();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Timer\timeout($promise, 10.0, $loop)->then(
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    function ($value) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        // the operation finished within 10.0 seconds
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    function ($error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        if ($error instanceof Timer\TimeoutException) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            // the operation has failed due to a timeout
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            // the input operation has failed due to some other error
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Or if you're using react/promise v2.2.0 or up:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          Timer\timeout($promise, 10.0, $loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    ->then(function ($value) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        // the operation finished within 10.0 seconds
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    ->otherwise(function (Timer\TimeoutException $error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        // the operation has failed due to a timeout
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    ->otherwise(function ($error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        // the input operation has failed due to some other error
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Timeout cancellation

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          As discussed above, the timeout() function will cancel the +underlying operation if it takes too long. +This means that you can be sure the resulting promise will then be rejected +with a TimeoutException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          However, what happens to the underlying input $promise is a bit more tricky: +Once the timer fires, we will try to call +$promise->cancel() +on the input $promise which in turn invokes its cancellation handler.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This means that it's actually up the input $promise to handle +cancellation support.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            A common use case involves cleaning up any resources like open network -sockets or file handles or terminating external processes or timers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            A common use case involves cleaning up any resources like open network sockets or +file handles or terminating external processes or timers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            If the given input $promise does not support cancellation, then this is a -NO-OP. This means that while the resulting promise will still be rejected, -the underlying input $promise may still be pending and can hence continue -consuming resources

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            If the given input $promise does not support cancellation, then this is a NO-OP. +This means that while the resulting promise will still be rejected, the underlying +input $promise may still be pending and can hence continue consuming resources.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          On top of this, the returned promise is implemented in such a way that it can -be cancelled when it is still pending. Cancelling a pending promise will -cancel the underlying operation. As discussed above, responsibility for this -cancellation logic is left up to the underlying operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = accessSomeRemoteResource();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$timeout = React\Promise\Timer\timeout($promise, 10.0);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$timeout->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          See the following chapter for more details on the cancellation handler.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Cancellation handler

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          For example, an implementation for the above operation could look like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          function accessSomeRemoteResource()
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +{
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    return new Promise(
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        function ($resolve, $reject) use (&$socket) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            // this will be called once the promise is created
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            // a common use case involves opening any resources and eventually resolving
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            $socket = createSocket();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            $socket->on('data', function ($data) use ($resolve) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +                $resolve($data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            });
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        },
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        function ($resolve, $reject) use (&$socket) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            // this will be called once calling `cancel()` on this promise
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            // a common use case involves cleaning any resources and then rejecting
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            $socket->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +            $reject(new \RuntimeException('Operation cancelled'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +}
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          In this example, calling $promise->cancel() will invoke the registered cancellation +handler which then closes the network socket and rejects the Promise instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          If no cancellation handler is passed to the Promise constructor, then invoking +its cancel() method it is effectively a NO-OP. +This means that it may still be pending and can hence continue consuming resources.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          For more details on the promise cancellation, please refer to the Promise documentation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          If you want to wait for multiple promises to resolve, you can use the normal -promise primitives like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promises = array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    accessSomeRemoteResource(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    accessSomeRemoteResource(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    accessSomeRemoteResource()
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$promise = React\Promise\all($promises);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -React\Promise\Timer\timeout($promise, 10)->then(function ($values) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    // *all* promises resolved
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The applies to all promise collection primitives alike, i.e. all(), -race(), any(), some() etc.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Input cancellation

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Irrespective of the timout handling, you can also explicitly cancel() the +input $promise at any time. +This means that the timeout() handling does not affect cancellation of the +input $promise, as demonstrated in the following example:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = accessSomeRemoteResource();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$timeout = Timer\timeout($promise, 10.0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The registered cancellation handler is responsible for +handling the cancel() call:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • A described above, a common use involves resource cleanup and will then reject +the Promise. +If the input $promise is being rejected, then the timeout will be aborted +and the resulting promise will also be rejected.
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • If the input $promise is still pending, then the timout will continue +running until the timer expires. +The same happens if the input $promise does not register a +cancellation handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Output cancellation

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Similarily, you can also explicitly cancel() the resulting promise like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promise = accessSomeRemoteResource();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$timeout = Timer\timeout($promise, 10.0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$timeout->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Note how this looks very similar to the above input cancellation +example. Accordingly, it also behaves very similar.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Calling cancel() on the resulting promise will merely try +to cancel() the input $promise. +This means that we do not take over responsibility of the outcome and it's +entirely up to the input $promise to handle cancellation support.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The registered cancellation handler is responsible for +handling the cancel() call:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • As described above, a common use involves resource cleanup and will then reject +the Promise. +If the input $promise is being rejected, then the timeout will be aborted +and the resulting promise will also be rejected.
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • If the input $promise is still pending, then the timout will continue +running until the timer expires. +The same happens if the input $promise does not register a +cancellation handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          To re-iterate, note that calling cancel() on the resulting promise will merely +try to cancel the input $promise only. +It is then up to the cancellation handler of the input promise to settle the promise. +If the input promise is still pending when the timeout occurs, then the normal +timeout cancellation handling will trigger, effectively rejecting +the output promise with a TimeoutException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This is done for consistency with the timeout cancellation +handling and also because it is assumed this is often used like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $timeout = Timer\timeout(accessSomeRemoteResource(), 10.0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$timeout->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          As described above, this example works as expected and cleans up any resources +allocated for the input $promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Note that if the given input $promise does not support cancellation, then this +is a NO-OP. +This means that while the resulting promise will still be rejected after the +timeout, the underlying input $promise may still be pending and can hence +continue consuming resources.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Collections

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          If you want to wait for multiple promises to resolve, you can use the normal promise primitives like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $promises = array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    accessSomeRemoteResource(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    accessSomeRemoteResource(),
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    accessSomeRemoteResource()
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$promise = \React\Promise\all($promises);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Timer\timeout($promise, 10, $loop)->then(function ($values) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    // *all* promises resolved
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The applies to all promise collection primitives alike, i.e. all(), race(), any(), some() etc.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          For more details on the promise primitives, please refer to the Promise documentation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          sleep()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The sleep(float $time, ?LoopInterface $loop = null): PromiseInterface<void> function can be used to -create a new promise that resolves in $time seconds.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          React\Promise\Timer\sleep(1.5)->then(function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    echo 'Thanks for waiting!' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Internally, the given $time value will be used to start a timer that will -resolve the promise once it triggers. This implies that if you pass a really -small (or negative) value, it will still start a timer and will thus trigger -at the earliest possible time in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This function takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use. You can use a null value here in order to -use the default loop. This value -SHOULD NOT be given unless you're sure you want to explicitly use a given event -loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The returned promise is implemented in such a way that it can be cancelled -when it is still pending. Cancelling a pending promise will reject its value -with a RuntimeException and clean up any pending timers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $timer = React\Promise\Timer\sleep(2.0);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$timer->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          resolve()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Deprecated since v1.8.0, see sleep() instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The resolve(float $time, ?LoopInterface $loop = null): PromiseInterface<float> function can be used to -create a new promise that resolves in $time seconds with the $time as the fulfillment value.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          React\Promise\Timer\resolve(1.5)->then(function ($time) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    echo 'Thanks for waiting ' . $time . ' seconds' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +resolve()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The resolve($time, LoopInterface $loop) function can be used to create a new Promise that +resolves in $time seconds with the $time as the fulfillment value.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          Timer\resolve(1.5, $loop)->then(function ($time) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    echo 'Thanks for waiting ' . $time . ' seconds' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Internally, the given $time value will be used to start a timer that will -resolve the promise once it triggers. This implies that if you pass a really -small (or negative) value, it will still start a timer and will thus trigger -at the earliest possible time in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This function takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use. You can use a null value here in order to -use the default loop. This value -SHOULD NOT be given unless you're sure you want to explicitly use a given event -loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The returned promise is implemented in such a way that it can be cancelled -when it is still pending. Cancelling a pending promise will reject its value -with a RuntimeException and clean up any pending timers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $timer = React\Promise\Timer\resolve(2.0);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$timer->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          reject()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Deprecated since v1.8.0, see sleep() instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The reject(float $time, ?LoopInterface $loop = null): PromiseInterface<never> function can be used to -create a new promise which rejects in $time seconds with a TimeoutException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          React\Promise\Timer\reject(2.0)->then(null, function (React\Promise\Timer\TimeoutException $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    echo 'Rejected after ' . $e->getTimeout() . ' seconds ' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +resolve the promise once it triggers. +This implies that if you pass a really small (or negative) value, it will still +start a timer and will thus trigger at the earliest possible time in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Resolve cancellation

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          You can explicitly cancel() the resulting timer promise at any time:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $timer = Timer\resolve(2.0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$timer->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This will abort the timer and reject with a RuntimeException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +reject()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The reject($time, LoopInterface $loop) function can be used to create a new Promise +which rejects in $time seconds with a TimeoutException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          Timer\reject(2.0, $loop)->then(null, function (TimeoutException $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    echo 'Rejected after ' . $e->getTimeout() . ' seconds ' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Internally, the given $time value will be used to start a timer that will -reject the promise once it triggers. This implies that if you pass a really -small (or negative) value, it will still start a timer and will thus trigger -at the earliest possible time in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This function takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use. You can use a null value here in order to -use the default loop. This value -SHOULD NOT be given unless you're sure you want to explicitly use a given event -loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The returned promise is implemented in such a way that it can be cancelled -when it is still pending. Cancelling a pending promise will reject its value -with a RuntimeException and clean up any pending timers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $timer = React\Promise\Timer\reject(2.0);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$timer->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          TimeoutException

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +reject the promise once it triggers. +This implies that if you pass a really small (or negative) value, it will still +start a timer and will thus trigger at the earliest possible time in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This function complements the resolve() function +and can be used as a basic building block for higher-level promise consumers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Reject cancellation

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          You can explicitly cancel() the resulting timer promise at any time:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $timer = Timer\reject(2.0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$timer->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This will abort the timer and reject with a RuntimeException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +TimeoutException

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The TimeoutException extends PHP's built-in RuntimeException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          getTimeout()

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The getTimeout(): float method can be used to -get the timeout value in seconds.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The recommended way to install this library is through Composer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The getTimeout() method can be used to get the timeout value in seconds.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This project follows SemVer. This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          composer require react/promise-timer:^1.11
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $ composer require react/promise-timer:^1.5

                                                                                                                                                                                                                                                                                                                                                                                                                                                          See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.3 through current PHP 8+ and +extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. -It's highly recommended to use the latest supported PHP version for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +It's highly recommended to use PHP 7+ for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                          To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $ composer install

                                                                                                                                                                                                                                                                                                                                                                                                                                                          To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          License

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $ php vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +License

                                                                                                                                                                                                                                                                                                                                                                                                                                                          MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -220,7 +202,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer License

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The MIT License (MIT)

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Copyright (c) 2015 Christian Lück, Cees-Jan Kiewiet, Jan Sorgalla, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Copyright (c) 2015 Christian Lück

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -243,8 +225,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          diff --git a/promise/changelog.html b/promise/changelog.html index 97e7f8ce0..2ea18009f 100644 --- a/promise/changelog.html +++ b/promise/changelog.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -41,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -221,12 +203,6 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Promise Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2025 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 3.3.0 - - - (2025-08-19) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Improve PHP 8.5+ support by avoiding deprecated switch case syntax.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#264 by @theodorejb)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Run tests on PHP 8.4 and update test environment.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#271 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2024 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 3.2.0 - - - (2024-05-24) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#260 by @Ayesh)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Include previous exceptions when reporting unhandled promise rejections.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#262 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Update test suite to improve PHP 8.4+ support.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#261 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2023 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 3.1.0 - - - (2023-11-16) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Full PHP 8.3 compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#255 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Describe all callable arguments with types for Promise and Deferred.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#253 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Update test suite and minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#251 by @ondrejmirtes and #250 by @SQKo)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 2.11.0 - - - (2023-11-16) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This is a compatibility release to ensure a smooth upgrade path for those not yet
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -on Promise v3. We encourage upgrading to the latest version when possible, as
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -Promise v3 will be the way forward for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Feature: Full PHP 8.3 compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#256 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.3.0 - - - (2023-11-16) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This is a compatibility release to ensure a smooth upgrade path for those not
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -yet on Promise v3. We encourage upgrading to the latest version when possible,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -as Promise v3 will be the way forward for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 3.0.0 - - - (2023-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            We'd like to emphasize that this component is production ready and battle-tested.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -We plan to support all long-term support (LTS) releases for at least 24 months,
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -so you have a rock-solid foundation to build on top of.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            The v3 release will be the way forward for this package. However, we will still
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -actively support v2 and v1 to provide a smooth upgrade path for those not yet
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -on the latest versions.

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This update involves some major new features and a minor BC break over the
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -v2.0.0 release. We've tried hard to avoid BC breaks where possible and
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -minimize impact otherwise. We expect that most consumers of this package will be
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -affected by BC breaks, but updating should take no longer than a few minutes.
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -See below for more details:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: PHP 8.1+ recommended, PHP 7.1+ required.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#138 and #149 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature / BC break: The PromiseInterface now includes the functionality of the old ExtendedPromiseInterface and CancellablePromiseInterface.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -Each promise now always includes the then(), catch(), finally() and cancel() methods.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -The new catch() and finally() methods replace the deprecated otherwise() and always() methods which continue to exist for BC reasons.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -The old ExtendedPromiseInterface and CancellablePromiseInterface are no longer needed and have been removed as a consequence.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#75 by @jsor and #208 by @clue and @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (multiple interfaces may or may not be implemented)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -assert($promise instanceof PromiseInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -assert(method_exists($promise, 'then'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -if ($promise instanceof ExtendedPromiseInterface) { assert(method_exists($promise, 'otherwise')); }
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -if ($promise instanceof ExtendedPromiseInterface) { assert(method_exists($promise, 'always')); }
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -if ($promise instanceof CancellablePromiseInterface) { assert(method_exists($promise, 'cancel')); }
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// new (single PromiseInterface with all methods)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -assert($promise instanceof PromiseInterface);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -assert(method_exists($promise, 'then'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -assert(method_exists($promise, 'catch'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -assert(method_exists($promise, 'finally'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -assert(method_exists($promise, 'cancel'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature / BC break: Improve type safety of promises. Require mixed fulfillment value argument and Throwable (or Exception) as rejection reason.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -Add PHPStan template types to ensure strict types for resolve(T $value): PromiseInterface<T> and reject(Throwable $reason): PromiseInterface<never>.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -It is no longer possible to resolve a promise without a value (use null instead) or reject a promise without a reason (use Throwable instead).
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#93, #141 and #142 by @jsor, #138, #149 and #247 by @WyriHaximus and #213 and #246 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            // old (arguments used to be optional)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise = resolve();
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise = reject();
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// new (already supported before)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise = resolve(null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$promise = reject(new RuntimeException());
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature / BC break: Report all unhandled rejections by default and remove done() method.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -Add new set_rejection_handler() function to set the global rejection handler for unhandled promise rejections.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#248, #249 and #224 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            // Unhandled promise rejection with RuntimeException: Unhandled in example.php:2
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -reject(new RuntimeException('Unhandled'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Remove all deprecated APIs and reduce API surface.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -Remove some(), map(), reduce() functions, use any() and all() functions instead.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -Remove internal FulfilledPromise and RejectedPromise classes, use resolve() and reject() functions instead.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -Remove legacy promise progress API (deprecated third argument to then() method) and deprecated LazyPromise class.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#32 and #98 by @jsor and #164, #219 and #220 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            BC break: Make all classes final to encourage composition over inheritance.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#80 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature / BC break: Require array (or iterable) type for all() + race() + any() functions and bring in line with ES6 specification.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -These functions now require a single argument with a variable number of promises or values as input.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#225 by @clue and #35 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix / BC break: Fix race() to return a forever pending promise when called with an empty array (or iterable) and bring in line with ES6 specification.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#83 by @jsor and #225 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Minor performance improvements by initializing Deferred in the constructor and avoiding call_user_func() calls.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#151 by @WyriHaximus and #171 by @Kubo2)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Minor documentation improvements.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#110 by @seregazhuk, #132 by @CharlotteDunois, #145 by @danielecr, #178 by @WyriHaximus, #189 by @SrDante, #212 by @clue, #214, #239 and #243 by @SimonFrings and #231 by @nhedger)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The following changes had to be ported to this release due to our branching
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -strategy, but also appeared in the 2.x branch:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The following changes were originally planned for this release but later reverted
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -and are not part of the final release:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Add iterative callback queue handler to avoid recursion (later removed to improve Fiber support).
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#28, #82 and #86 by @jsor, #158 by @WyriHaximus and #229 and #238 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Trigger an E_USER_ERROR instead of throwing an exception from done() (later removed entire done() method to globally report unhandled rejections).
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#97 by @jsor and #224 and #248 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Add type declarations for some() (later removed entire some() function).
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#172 by @WyriHaximus and #219 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 2.10.0 - - - (2023-05-02) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2022 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 2.9.0 - - - (2022-02-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support union types and address deprecation of ReflectionType::getClass() (PHP 8+).
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#198 by @cdosoftei and @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            $promise->otherwise(function (OverflowException|UnderflowException $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support intersection types (PHP 8.1+).
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#195 by @bzikarsky)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            $promise->otherwise(function (OverflowException&CacheException $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite, use GitHub actions for continuous integration (CI),
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -update to PHPUnit 9, and add full core team to the license.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#174, #183, #186, and #201 by @SimonFrings and #211 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2020 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 2.8.0 - - - (2020-05-12) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Mark FulfilledPromise, RejectedPromise and LazyPromise as deprecated for Promise v2 (and remove for Promise v3).
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#143 and #165 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            // deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$fulfilled = new React\Promise\FulfilledPromise($value);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$rejected = new React\Promise\RejectedPromise($reason);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -// recommended alternatives
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$fulfilled = React\Promise\resolve($value);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$rejected = React\Promise\reject($reason);
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fix checking whether cancellable promise is an object and avoid possible warning.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#168 by @smscr and @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve documentation and add docblocks to functions and interfaces.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#135 by @CharlotteDunois)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Add .gitattributes to exclude dev files from exports.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#154 by @reedy)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite, run tests on PHP 7.4 and update PHPUnit test setup.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#163 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2019 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 2.7.1 - - - (2019-01-07) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Fix: file_exists warning when resolving with long strings. (#130 by @sbesselsen)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improve performance by prefixing all global functions calls with \ to skip the look up and resolve process and go straight to the global function. (#133 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          2018

                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -716,9 +231,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Feature: Improve memory consumption for pending promises by using static internal callbacks without binding to self.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#124 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +(#124 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -736,35 +251,35 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Significantly improve memory consumption and performance by only passing resolver args
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Significantly improve memory consumption and performance by only passing resolver args
                                                                                                                                                                                                                                                                                                                                                                                                                                                                to resolver and canceller if callback requires them. Also use static callbacks without
                                                                                                                                                                                                                                                                                                                                                                                                                                                                binding to promise, clean up canceller function reference when they are no longer
                                                                                                                                                                                                                                                                                                                                                                                                                                                                needed and hide resolver and canceller references from call stack on PHP 7+.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#113, #115, #116, #117, #118, #119 and #123 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                These changes combined mean that rejecting promises with an Exception should
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#113, #115, #116, #117, #118, #119 and #123 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                These changes combined mean that rejecting promises with an Exception should
                                                                                                                                                                                                                                                                                                                                                                                                                                                                no longer cause any internal circular references which could cause some unexpected
                                                                                                                                                                                                                                                                                                                                                                                                                                                                memory growth in previous versions. By explicitly avoiding and explicitly
                                                                                                                                                                                                                                                                                                                                                                                                                                                                cleaning up said references, we can avoid relying on PHP's circular garbage collector
                                                                                                                                                                                                                                                                                                                                                                                                                                                                to kick in which significantly improves performance when rejecting many promises.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Mark legacy progress support / notification API as deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#112 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Mark legacy progress support / notification API as deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#112 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Recommend rejecting promises by throwing an exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#114 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Recommend rejecting promises by throwing an exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#114 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve documentation to properly instantiate LazyPromise
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#121 by @holtkamp)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve documentation to properly instantiate LazyPromise
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#121 by @holtkamp)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Follower cancellation propagation was originally planned for this release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Follower cancellation propagation was originally planned for this release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                but has been reverted for now and is planned for a future release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#99 by @jsor and #122 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#99 by @jsor and #122 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -788,8 +303,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Fix circular references when resolving with a promise which follows itself (#94).
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Fix circular references when resolving with a promise which follows itself (#94).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -812,27 +327,27 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Revert automatic cancellation of pending collection promises once the output promise resolves. This was introduced in 42d86b7 (PR #36, released in v2.3.0) and was both unintended and backward incompatible.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    If you need automatic cancellation, you can use something like:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    function allAndCancel(array $promises)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -     return \React\Promise\all($promises)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -         ->always(function() use ($promises) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -             foreach ($promises as $promise) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -                 if ($promise instanceof \React\Promise\CancellablePromiseInterface) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -                     $promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -                 }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -             }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Revert automatic cancellation of pending collection promises once the output promise resolves. This was introduced in 42d86b7 (PR #36, released in v2.3.0) and was both unintended and backward incompatible.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    If you need automatic cancellation, you can use something like:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    function allAndCancel(array $promises)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +{
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +     return \React\Promise\all($promises)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +         ->always(function() use ($promises) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +             foreach ($promises as $promise) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +                 if ($promise instanceof \React\Promise\CancellablePromiseInterface) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +                     $promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +                 }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +             }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +        });
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    all() and map() functions now preserve the order of the array (#77).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    all() and map() functions now preserve the order of the array (#77).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix circular references when resolving a promise with itself (#71).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix circular references when resolving a promise with itself (#71).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -851,8 +366,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Fix some() not cancelling pending promises when too much input promises reject (16ff799).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Fix some() not cancelling pending promises when too much input promises reject (16ff799).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -870,10 +385,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Support foreign thenables in resolve().
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -Any object that provides a then() method is now assimilated to a trusted promise that follows the state of this thenable (#52).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Fix some() and any() for input arrays containing not enough items (#34).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Support foreign thenables in resolve().
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +Any object that provides a then() method is now assimilated to a trusted promise that follows the state of this thenable (#52).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Fix some() and any() for input arrays containing not enough items (#34).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -891,9 +406,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Allow cancellation of promises returned by functions working on promise collections (#36).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Handle \Throwable in the same way as \Exception (#51 by @joshdifabio).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Allow cancellation of promises returned by functions working on promise collections (#36).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Handle \Throwable in the same way as \Exception (#51 by @joshdifabio).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -911,8 +426,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Fix DeferredPromise to also implement the CancellablePromiseInterface.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Fix DeferredPromise to also implement the CancellablePromiseInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -930,8 +445,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          This release makes the API more compatible with 2.0 while preserving full backward compatibility.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This release makes the API more compatible with 2.0 while preserving full backward compatibility.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Introduce new CancellablePromiseInterface implemented by all promises.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Add new .cancel() method (part of the CancellablePromiseInterface).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -951,8 +466,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Fix cancellation handlers called multiple times (#47 by @clue).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Fix cancellation handlers called multiple times (#47 by @clue).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -975,7 +490,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Fix stack error when resolving a promise in its own fulfillment or rejection handlers.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -994,10 +509,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                This release makes the API more compatible with 2.0 while preserving full backward compatibility.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Add React\Promise\Promise class.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Move methods of React\Promise\When and React\Promise\Util to functions while keeping the classes as a proxy for BC.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  This release makes the API more compatible with 2.0 while preserving full backward compatibility.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Add React\Promise\Promise class.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Move methods of React\Promise\When and React\Promise\Util to functions while keeping the classes as a proxy for BC.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1020,8 +535,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  This release introduces the ExtendedPromiseInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The ExtendedPromiseInterface extends the PromiseInterface with useful shortcut
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  This release introduces the ExtendedPromiseInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The ExtendedPromiseInterface extends the PromiseInterface with useful shortcut
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  and utility methods which are not part of the Promises/A specification.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1039,7 +554,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Introduce new CancellablePromiseInterface implemented by all promises.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Introduce new CancellablePromiseInterface implemented by all promises.


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1061,8 +576,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  New major release. The goal was to streamline the API and to make it more compliant with other promise libraries and especially with the new upcoming ES6 promises specification.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    New major release. The goal was to streamline the API and to make it more compliant with other promise libraries and especially with the new upcoming ES6 promises specification.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Add standalone Promise class.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Add new React\Promise\race() function.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • BC break: Bump minimum PHP version to PHP 5.4.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • @@ -1088,10 +603,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Trigger PHP errors when invalid callback is passed.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Fully resolve rejection value before calling rejection handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Add When::lazy() to create lazy promises which will be initialized once a consumer calls the then() method.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Add When::lazy() to create lazy promises which will be initialized once a consumer calls the then() method.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1114,8 +629,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Add PromisorInterface for objects that have a promise() method.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Add PromisorInterface for objects that have a promise() method.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1133,9 +648,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Fix bug in When::any() not correctly unwrapping to a single result value
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • $promiseOrValue argument of When::resolve() and When::reject() is now optional
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Fix bug in When::any() not correctly unwrapping to a single result value
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • $promiseOrValue argument of When::resolve() and When::reject() is now optional

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1153,7 +668,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Prevent deep recursion which was reaching xdebug.max_nesting_level default of 100
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1172,7 +687,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1193,8 +708,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Promise
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                diff --git a/promise/index.html b/promise/index.html index 09283203e..b6d921685 100644 --- a/promise/index.html +++ b/promise/index.html @@ -5,7 +5,8 @@ - Promise - ReactPHP + Promise: +Promise - ReactPHP @@ -20,13 +21,13 @@ - - + + - - - + + + @@ -40,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • PromiseInterface +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +ExtendedPromiseInterface + +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +CancellablePromiseInterface +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Promise
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • FulfilledPromise
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • RejectedPromise
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • LazyPromise
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Functions
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • PromisorInterface
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • @@ -280,79 +281,109 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Resolution forwarding
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Rejection forwarding
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Mixed resolution and rejection forwarding
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Progress event forwarding
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • done() vs. then()
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Install
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Tests
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Credits
                                                                                                                                                                                                                                                                                                                                                                                                                                                • License
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Introduction

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Introduction

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Promise is a library implementing CommonJS Promises/A for PHP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  It also provides several other useful promise-related concepts, such as joining multiple promises and mapping and reducing collections of promises.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  If you've never heard about promises before, -read this first.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Concepts

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Deferred

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +read this first.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Concepts

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Deferred

                                                                                                                                                                                                                                                                                                                                                                                                                                                  A Deferred represents a computation or unit of work that may not have completed yet. Typically (but not always), that computation will be something that executes asynchronously and completes at some point in the future.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                  While a deferred represents the computation itself, a Promise represents the result of that computation. Thus, each deferred has a promise that acts as a placeholder for its actual result.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  API

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Deferred

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +API

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Deferred

                                                                                                                                                                                                                                                                                                                                                                                                                                                  A deferred represents an operation whose resolution is pending. It has separate promise and resolver parts.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$promise = $deferred->promise();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$deferred->resolve(mixed $value);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$deferred->reject(\Throwable $reason);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$promise = $deferred->promise();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$deferred->resolve(mixed $value = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$deferred->reject(mixed $reason = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$deferred->notify(mixed $update = null);

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The promise method returns the promise of the deferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The resolve and reject methods control the state of the deferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The deprecated notify method is for progress notification.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The constructor of the Deferred accepts an optional $canceller argument. See Promise for more information.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Deferred::promise()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise = $deferred->promise();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Deferred::promise()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise = $deferred->promise();

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Returns the promise of the deferred, which you can hand out to others while keeping the authority to modify its state to yourself.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Deferred::resolve()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $deferred->resolve(mixed $value);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Deferred::resolve()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $deferred->resolve(mixed $value = null);

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Resolves the promise returned by promise(). All consumers are notified by having $onFulfilled (which they registered via $promise->then()) called with $value.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  If $value itself is a promise, the promise will transition to the state of this promise once it is resolved.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  See also the resolve() function.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Deferred::reject()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $deferred->reject(\Throwable $reason);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Deferred::reject()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $deferred->reject(mixed $reason = null);

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Rejects the promise returned by promise(), signalling that the deferred's computation failed. All consumers are notified by having $onRejected (which they registered via $promise->then()) called with $reason.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  See also the reject() function.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  PromiseInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  If $reason itself is a promise, the promise will be rejected with the outcome +of this promise regardless whether it fulfills or rejects.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Deferred::notify()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Deprecated in v2.6.0: Progress support is deprecated and should not be used anymore.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $deferred->notify(mixed $update = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Triggers progress notifications, to indicate to consumers that the computation +is making progress toward its result.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  All consumers are notified by having $onProgress (which they registered via +$promise->then()) called with $update.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +PromiseInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The promise interface provides the common interface for all promise -implementations. -See Promise for the only public implementation exposed by this -package.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +implementations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  A promise represents an eventual outcome, which is either fulfillment (success) and an associated value, or rejection (failure) and an associated reason.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Once in the fulfilled or rejected state, a promise becomes immutable. Neither its state nor its result (or error) can be modified.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  PromiseInterface::then()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $transformedPromise = $promise->then(callable $onFulfilled = null, callable $onRejected = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Implementations

                                                                                                                                                                                                                                                                                                                                                                                                                                                  + +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +PromiseInterface::then()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $transformedPromise = $promise->then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Transforms a promise's value by applying a function to the promise's fulfillment or rejection value. Returns a new promise for the transformed result.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The then() method registers new fulfilled and rejection handlers with a promise -(all parameters are optional):

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The then() method registers new fulfilled, rejection and progress handlers +with a promise (all parameters are optional):

                                                                                                                                                                                                                                                                                                                                                                                                                                                  • $onFulfilled will be invoked once the promise is fulfilled and passed @@ -360,6 +391,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                  • $onRejected will be invoked once the promise is rejected and passed the reason as the first argument.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +$onProgress (deprecated) will be invoked whenever the producer of the promise +triggers progress notifications and passed a single argument (whatever it +wants) to indicate progress.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  It returns a new promise that will fulfill with the return value of either $onFulfilled or $onRejected, whichever is called, or will reject with @@ -372,30 +407,64 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                • $onFulfilled and $onRejected will never be called more than once.
                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                • +$onProgress (deprecated) may be called multiple times.
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  See also

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +See also

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +ExtendedPromiseInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The ExtendedPromiseInterface extends the PromiseInterface with useful shortcut +and utility methods which are not part of the Promises/A specification.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +Implementations

                                                                                                                                                                                                                                                                                                                                                                                                                                                  + +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +ExtendedPromiseInterface::done()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise->done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Consumes the promise's ultimate value if the promise fulfills, or handles the +ultimate error.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  It will cause a fatal error if either $onFulfilled or $onRejected throw or +return a rejected promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Since the purpose of done() is consumption rather than transformation, +done() always returns null.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +See also

                                                                                                                                                                                                                                                                                                                                                                                                                                                  + -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  PromiseInterface::catch()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise->catch(callable $onRejected);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +ExtendedPromiseInterface::otherwise()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise->otherwise(callable $onRejected);

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Registers a rejection handler for promise. It is a shortcut for:

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise->then(null, $onRejected);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise->then(null, $onRejected);

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Additionally, you can type hint the $reason argument of $onRejected to catch only specific errors.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    ->catch(function (\RuntimeException $reason) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        // Only catch \RuntimeException instances
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        // All other types of errors will propagate automatically
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    ->catch(function (\Throwable $reason) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -        // Catch other errors
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  PromiseInterface::finally()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $newPromise = $promise->finally(callable $onFulfilledOrRejected);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    ->otherwise(function (\RuntimeException $reason) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        // Only catch \RuntimeException instances
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        // All other types of errors will propagate automatically
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    ->otherwise(function ($reason) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +        // Catch other errors
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +    )};
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +ExtendedPromiseInterface::always()

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $newPromise = $promise->always(callable $onFulfilledOrRejected);

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Allows you to execute "cleanup" type tasks in a promise chain.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  It arranges for $onFulfilledOrRejected to be called, with no arguments, when the promise is either fulfilled or rejected.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -411,67 +480,76 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                  rejected promise, $newPromise will reject with the thrown exception or rejected promise's reason.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                finally() behaves similarly to the synchronous finally statement. When combined -with catch(), finally() allows you to write code that is similar to the familiar +

                                                                                                                                                                                                                                                                                                                                                                                                                                                always() behaves similarly to the synchronous finally statement. When combined +with otherwise(), always() allows you to write code that is similar to the familiar synchronous catch/finally pair.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Consider the following synchronous code:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                try {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    return doSomething();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -} catch (\Throwable $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    return handleError($e);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -} finally {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    cleanup();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                try {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +  return doSomething();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +} catch(\Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    return handleError($e);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +} finally {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    cleanup();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +}

                                                                                                                                                                                                                                                                                                                                                                                                                                                Similar asynchronous code (with doSomething() that returns a promise) can be written:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                return doSomething()
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->catch('handleError')
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->finally('cleanup');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseInterface::cancel()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                return doSomething()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->otherwise('handleError')
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->always('cleanup');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +ExtendedPromiseInterface::progress()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Deprecated in v2.6.0: Progress support is deprecated and should not be used anymore.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise->progress(callable $onProgress);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Registers a handler for progress updates from promise. It is a shortcut for:

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise->then(null, null, $onProgress);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +CancellablePromiseInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                A cancellable promise provides a mechanism for consumers to notify the creator +of the promise that they are not longer interested in the result of an +operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +CancellablePromiseInterface::cancel()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise->cancel();

                                                                                                                                                                                                                                                                                                                                                                                                                                                The cancel() method notifies the creator of the promise that there is no further interest in the results of the operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Once a promise is settled (either fulfilled or rejected), calling cancel() on a promise has no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseInterface::otherwise()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Deprecated since v3.0.0, see catch() instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The otherwise() method registers a rejection handler for a promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This method continues to exist only for BC reasons and to ease upgrading -between versions. It is an alias for:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise->catch($onRejected);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseInterface::always()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Deprecated since v3.0.0, see finally() instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The always() method allows you to execute "cleanup" type tasks in a promise chain.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This method continues to exist only for BC reasons and to ease upgrading -between versions. It is an alias for:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise->finally($onFulfilledOrRejected);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Implementations

                                                                                                                                                                                                                                                                                                                                                                                                                                                + +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                Creates a promise whose state is controlled by the functions passed to $resolver.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $resolver = function (callable $resolve, callable $reject) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // Do some work, possibly asynchronously, and then
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // resolve or reject.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $resolve($awesomeResult);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // or throw new Exception('Promise rejected');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // or $resolve($anotherPromise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // or $reject($nastyError);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -};
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$canceller = function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // Cancel/abort any running operations like network connections, streams etc.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // Reject promise by throwing an exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    throw new Exception('Promise cancelled');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -};
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promise = new React\Promise\Promise($resolver, $canceller);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $resolver = function (callable $resolve, callable $reject, callable $notify) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // Do some work, possibly asynchronously, and then
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // resolve or reject. You can notify of progress events (deprecated)
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // along the way if you want/need.
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $resolve($awesomeResult);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // or throw new Exception('Promise rejected');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // or $resolve($anotherPromise);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // or $reject($nastyError);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // or $notify($progressNotification);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +};
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$canceller = function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // Cancel/abort any running operations like network connections, streams etc.
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // Reject promise by throwing an exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    throw new Exception('Promise cancelled');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +};
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$promise = new React\Promise\Promise($resolver, $canceller);

                                                                                                                                                                                                                                                                                                                                                                                                                                                The promise constructor receives a resolver function and an optional canceller -function which both will be called with two arguments:

                                                                                                                                                                                                                                                                                                                                                                                                                                                +function which both will be called with 3 arguments:

                                                                                                                                                                                                                                                                                                                                                                                                                                                • $resolve($value) - Primary function that seals the fate of the @@ -482,276 +560,364 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Promise

                                                                                                                                                                                                                                                                                                                                                                                                                                                • $reject($reason) - Function that rejects the promise. It is recommended to just throw an exception instead of using $reject().
                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                • +$notify($update) - Deprecated function that issues progress events for the promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the resolver or canceller throw an exception, the promise will be rejected with that thrown exception as the rejection reason.

                                                                                                                                                                                                                                                                                                                                                                                                                                                The resolver function will be called immediately, the canceller function only once all consumers called the cancel() method of the promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Functions

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Useful functions for creating and joining collections of promises.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                All functions working on promise collections (like all(), race(), +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +FulfilledPromise

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Creates a already fulfilled promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\FulfilledPromise($value);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note, that $value cannot be a promise. It's recommended to use +resolve() for creating resolved promises.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +RejectedPromise

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Creates a already rejected promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\RejectedPromise($reason);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note, that $reason cannot be a promise. It's recommended to use +reject() for creating rejected promises.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +LazyPromise

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Creates a promise which will be lazily initialized by $factory once a consumer +calls the then() method.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $factory = function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // Do some heavy stuff here and resolve the deferred once completed
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    return $deferred->promise();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +};
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$promise = new React\Promise\LazyPromise($factory);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +// $factory will only be executed once we call then()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$promise->then(function ($value) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Functions

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Useful functions for creating, joining, mapping and reducing collections of +promises.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                All functions working on promise collections (like all(), race(), some() etc.) support cancellation. This means, if you call cancel() on the returned -promise, all promises in the collection are cancelled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                resolve()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\resolve(mixed $promiseOrValue);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +promise, all promises in the collection are cancelled. If the collection itself +is a promise which resolves to an array, this promise is also cancelled.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +resolve()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\resolve(mixed $promiseOrValue);

                                                                                                                                                                                                                                                                                                                                                                                                                                                Creates a promise for the supplied $promiseOrValue.

                                                                                                                                                                                                                                                                                                                                                                                                                                                If $promiseOrValue is a value, it will be the resolution value of the returned promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                If $promiseOrValue is a thenable (any object that provides a then() method), a trusted promise that follows the state of the thenable is returned.

                                                                                                                                                                                                                                                                                                                                                                                                                                                If $promiseOrValue is a promise, it will be returned as is.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The resulting $promise implements the PromiseInterface -and can be consumed like any other promise:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\resolve(42);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promise->then(function (int $result): void {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($result);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (\Throwable $e): void {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                reject()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\reject(\Throwable $reason);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Creates a rejected promise for the supplied $reason.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the \Throwable interface introduced in PHP 7 covers -both user land \Exception's and -\Error internal PHP errors. By enforcing \Throwable as reason to -reject a promise, any language error or user land exception can be used to reject a promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The resulting $promise implements the PromiseInterface -and can be consumed like any other promise:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\reject(new RuntimeException('Request failed'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promise->then(function (int $result): void {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    var_dump($result);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (\Throwable $e): void {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that rejected promises should always be handled similar to how any -exceptions should always be caught in a try + catch block. If you remove the -last reference to a rejected promise that has not been handled, it will -report an unhandled promise rejection:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                function incorrect(): int
                                                                                                                                                                                                                                                                                                                                                                                                                                                -{
                                                                                                                                                                                                                                                                                                                                                                                                                                                -     $promise = React\Promise\reject(new RuntimeException('Request failed'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -     // Commented out: No rejection handler registered here.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -     // $promise->then(null, function (\Throwable $e): void { /* ignore */ });
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -     // Returning from a function will remove all local variable references, hence why
                                                                                                                                                                                                                                                                                                                                                                                                                                                -     // this will report an unhandled promise rejection here.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -     return 42;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -// Calling this function will log an error message plus its stack trace:
                                                                                                                                                                                                                                                                                                                                                                                                                                                -// Unhandled promise rejection with RuntimeException: Request failed in example.php:10
                                                                                                                                                                                                                                                                                                                                                                                                                                                -incorrect();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                A rejected promise will be considered "handled" if you catch the rejection -reason with either the then() method, the -catch() method, or the -finally() method. Note that each of these methods -return a new promise that may again be rejected if you re-throw an exception.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                A rejected promise will also be considered "handled" if you abort the operation -with the cancel() method (which in turn would -usually reject the promise if it is still pending).

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the set_rejection_handler() function.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                all()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\all(iterable $promisesOrValues);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note: The promise returned is always a promise implementing +ExtendedPromiseInterface. If you pass in a custom +promise which only implements PromiseInterface, this +promise will be assimilated to a extended promise following $promiseOrValue.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +reject()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\reject(mixed $promiseOrValue);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Creates a rejected promise for the supplied $promiseOrValue.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                If $promiseOrValue is a value, it will be the rejection value of the +returned promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                If $promiseOrValue is a promise, its completion value will be the rejected +value of the returned promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                This can be useful in situations where you need to reject a promise without +throwing an exception. For example, it allows you to propagate a rejection with +the value of another promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +all()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\all(array|React\Promise\PromiseInterface $promisesOrValues);

                                                                                                                                                                                                                                                                                                                                                                                                                                                Returns a promise that will resolve only once all the items in $promisesOrValues have resolved. The resolution value of the returned promise will be an array containing the resolution values of each of the items in $promisesOrValues.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                race()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\race(iterable $promisesOrValues);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +race()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\race(array|React\Promise\PromiseInterface $promisesOrValues);

                                                                                                                                                                                                                                                                                                                                                                                                                                                Initiates a competitive race that allows one winner. Returns a promise which is resolved in the same way the first settled promise resolves.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The returned promise will become infinitely pending if $promisesOrValues -contains 0 items.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                any()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\any(iterable $promisesOrValues);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +any()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\any(array|React\Promise\PromiseInterface $promisesOrValues);

                                                                                                                                                                                                                                                                                                                                                                                                                                                Returns a promise that will resolve when any one of the items in $promisesOrValues resolves. The resolution value of the returned promise will be the resolution value of the triggering item.

                                                                                                                                                                                                                                                                                                                                                                                                                                                The returned promise will only reject if all items in $promisesOrValues are -rejected. The rejection value will be a React\Promise\Exception\CompositeException -which holds all rejection reasons. The rejection reasons can be obtained with -CompositeException::getThrowables().

                                                                                                                                                                                                                                                                                                                                                                                                                                                +rejected. The rejection value will be an array of all rejection reasons.

                                                                                                                                                                                                                                                                                                                                                                                                                                                The returned promise will also reject with a React\Promise\Exception\LengthException if $promisesOrValues contains 0 items.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                set_rejection_handler()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                React\Promise\set_rejection_handler(?callable $callback): ?callable;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Sets the global rejection handler for unhandled promise rejections.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that rejected promises should always be handled similar to how any -exceptions should always be caught in a try + catch block. If you remove -the last reference to a rejected promise that has not been handled, it will -report an unhandled promise rejection. See also the reject() function -for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The ?callable $callback argument MUST be a valid callback function that -accepts a single Throwable argument or a null value to restore the -default promise rejection handler. The return value of the callback function -will be ignored and has no effect, so you SHOULD return a void value. The -callback function MUST NOT throw or the program will be terminated with a -fatal error.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The function returns the previous rejection handler or null if using the -default promise rejection handler.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The default promise rejection handler will log an error message plus its stack -trace:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                // Unhandled promise rejection with RuntimeException: Unhandled in example.php:2
                                                                                                                                                                                                                                                                                                                                                                                                                                                -React\Promise\reject(new RuntimeException('Unhandled'));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The promise rejection handler may be used to use customize the log message or -write to custom log targets. As a rule of thumb, this function should only be -used as a last resort and promise rejections are best handled with either the -then() method, the -catch() method, or the -finally() method. -See also the reject() function for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Examples

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                How to use Deferred

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                function getAwesomeResultPromise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                -{
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // Execute a Node.js-style function using the callback pattern
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    computeAwesomeResultAsynchronously(function (\Throwable $error, $result) use ($deferred) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        if ($error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -            $deferred->reject($error);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -            $deferred->resolve($result);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // Return the promise
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    return $deferred->promise();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -}
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -getAwesomeResultPromise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->then(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        function ($value) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -            // Deferred resolved, do something with $value
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        },
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        function (\Throwable $reason) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -            // Deferred rejected, do something with $reason
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                How promise forwarding works

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +some()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\some(array|React\Promise\PromiseInterface $promisesOrValues, integer $howMany);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Returns a promise that will resolve when $howMany of the supplied items in +$promisesOrValues resolve. The resolution value of the returned promise +will be an array of length $howMany containing the resolution values of the +triggering items.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                The returned promise will reject if it becomes impossible for $howMany items +to resolve (that is, when (count($promisesOrValues) - $howMany) + 1 items +reject). The rejection value will be an array of +(count($promisesOrValues) - $howMany) + 1 rejection reasons.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                The returned promise will also reject with a React\Promise\Exception\LengthException +if $promisesOrValues contains less items than $howMany.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +map()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\map(array|React\Promise\PromiseInterface $promisesOrValues, callable $mapFunc);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Traditional map function, similar to array_map(), but allows input to contain +promises and/or values, and $mapFunc may return either a value or a promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                The map function receives each item as argument, where item is a fully resolved +value of a promise or value in $promisesOrValues.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +reduce()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = React\Promise\reduce(array|React\Promise\PromiseInterface $promisesOrValues, callable $reduceFunc , $initialValue = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Traditional reduce function, similar to array_reduce(), but input may contain +promises and/or values, and $reduceFunc may return either a value or a +promise, and $initialValue may be a promise or a value for the starting +value.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +PromisorInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\Promise\PromisorInterface provides a common interface for objects +that provide a promise. React\Promise\Deferred implements it, but since it +is part of the public API anyone can implement it.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Examples

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +How to use Deferred

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                function getAwesomeResultPromise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +{
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // Execute a Node.js-style function using the callback pattern
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    computeAwesomeResultAsynchronously(function ($error, $result) use ($deferred) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        if ($error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            $deferred->reject($error);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            $deferred->resolve($result);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    // Return the promise
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    return $deferred->promise();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +}
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +getAwesomeResultPromise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->then(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        function ($value) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            // Deferred resolved, do something with $value
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        },
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        function ($reason) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            // Deferred rejected, do something with $reason
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        },
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        function ($update) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            // Progress notification triggered, do something with $update
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +How promise forwarding works

                                                                                                                                                                                                                                                                                                                                                                                                                                                A few simple examples to show how the mechanics of Promises/A forwarding works. These examples are contrived, of course, and in real usage, promise chains will typically be spread across several function calls, or even several levels of your application architecture.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Resolution forwarding

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Resolution forwarding

                                                                                                                                                                                                                                                                                                                                                                                                                                                Resolved promises forward resolution values to the next promise. The first promise, $deferred->promise(), will resolve with the value passed to $deferred->resolve() below.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Each call to then() returns a new promise that will resolve with the return value of the previous handler. This creates a promise "pipeline".

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$deferred->promise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // $x will be the value passed to $deferred->resolve() below
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // and returns a *new promise* for $x + 1
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return $x + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // $x === 2
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // This handler receives the return value of the
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // previous handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return $x + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // $x === 3
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // This handler receives the return value of the
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // previous handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return $x + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // $x === 4
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // This handler receives the return value of the
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // previous handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'Resolve ' . $x;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$deferred->resolve(1); // Prints "Resolve 4"
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Rejection forwarding

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$deferred->promise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // $x will be the value passed to $deferred->resolve() below
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // and returns a *new promise* for $x + 1
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return $x + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // $x === 2
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // This handler receives the return value of the
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // previous handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return $x + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // $x === 3
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // This handler receives the return value of the
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // previous handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return $x + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // $x === 4
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // This handler receives the return value of the
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // previous handler.
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        echo 'Resolve ' . $x;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$deferred->resolve(1); // Prints "Resolve 4"
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Rejection forwarding

                                                                                                                                                                                                                                                                                                                                                                                                                                                Rejected promises behave similarly, and also work similarly to try/catch: When you catch an exception, you must rethrow for it to propagate.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Similarly, when you handle a rejected promise, to propagate the rejection, "rethrow" it by either returning a rejected promise, or actually throwing (since promise translates thrown exceptions into rejections)

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$deferred->promise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        throw new \Exception($x + 1);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->catch(function (\Exception $x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // Propagate the rejection
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        throw $x;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->catch(function (\Exception $x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // Can also propagate by returning another rejection
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return React\Promise\reject(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -            new \Exception($x->getMessage() + 1)
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        );
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->catch(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'Reject ' . $x->getMessage(); // 3
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$deferred->resolve(1);  // Prints "Reject 3"
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Mixed resolution and rejection forwarding

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$deferred->promise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        throw new \Exception($x + 1);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->otherwise(function (\Exception $x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // Propagate the rejection
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        throw $x;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->otherwise(function (\Exception $x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // Can also propagate by returning another rejection
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return React\Promise\reject(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            new \Exception($x->getMessage() + 1)
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        );
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->otherwise(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        echo 'Reject ' . $x->getMessage(); // 3
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$deferred->resolve(1);  // Prints "Reject 3"
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Mixed resolution and rejection forwarding

                                                                                                                                                                                                                                                                                                                                                                                                                                                Just like try/catch, you can choose to propagate or not. Mixing resolutions and rejections will still forward handler results in a predictable way.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$deferred->promise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return $x + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        throw new \Exception($x + 1);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->catch(function (\Exception $x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // Handle the rejection, and don't propagate.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // This is like catch without a rethrow
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        return $x->getMessage() + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        echo 'Mixed ' . $x; // 4
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$deferred->resolve(1);  // Prints "Mixed 4"
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$deferred->promise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return $x + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        throw new \Exception($x + 1);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->otherwise(function (\Exception $x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // Handle the rejection, and don't propagate.
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // This is like catch without a rethrow
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return $x->getMessage() + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->then(function ($x) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        echo 'Mixed ' . $x; // 4
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$deferred->resolve(1);  // Prints "Mixed 4"
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Progress event forwarding

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Deprecated in v2.6.0: Progress support is deprecated and should not be used anymore.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                In the same way as resolution and rejection handlers, your progress handler +MUST return a progress event to be propagated to the next link in the chain. +If you return nothing, null will be propagated.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Also in the same way as resolutions and rejections, if you don't register a +progress handler, the update will be propagated through.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                If your progress handler throws an exception, the exception will be propagated +to the next link in the chain. The best thing to do is to ensure your progress +handlers do not throw exceptions.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                This gives you the opportunity to transform progress events at each step in the +chain so that they are meaningful to the next step. It also allows you to choose +not to transform them, and simply let them propagate untransformed, by not +registering a progress handler.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $deferred = new React\Promise\Deferred();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$deferred->promise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->progress(function ($update) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        return $update + 1;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    })
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->progress(function ($update) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        echo 'Progress ' . $update; // 2
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$deferred->notify(1);  // Prints "Progress 2"
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +done() vs. then()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                The golden rule is:

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                Either return your promise, or call done() on it.
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                At a first glance, then() and done() seem very similar. However, there are +important distinctions.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                The intent of then() is to transform a promise's value and to pass or return +a new promise for the transformed value along to other parts of your code.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                The intent of done() is to consume a promise's value, transferring +responsibility for the value to your code.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                In addition to transforming a value, then() allows you to recover from, or +propagate intermediate errors. Any errors that are not handled will be caught +by the promise machinery and used to reject the promise returned by then().

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Calling done() transfers all responsibility for errors to your code. If an +error (either a thrown exception or returned rejection) escapes the +$onFulfilled or $onRejected callbacks you provide to done, it will be +rethrown in an uncatchable way causing a fatal error.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                function getJsonResult()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +{
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    return queryApi()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        ->then(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            // Transform API results to an object
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            function ($jsonResultString) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +                return json_decode($jsonResultString);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            },
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            // Transform API errors to an exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            function ($jsonErrorString) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +                $object = json_decode($jsonErrorString);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +                throw new ApiErrorException($object->errorMessage);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            }
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        );
                                                                                                                                                                                                                                                                                                                                                                                                                                                +}
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +// Here we provide no rejection handler. If the promise returned has been
                                                                                                                                                                                                                                                                                                                                                                                                                                                +// rejected, the ApiErrorException will be thrown
                                                                                                                                                                                                                                                                                                                                                                                                                                                +getJsonResult()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->done(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        // Consume transformed object
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        function ($jsonResultObject) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            // Do something with $jsonResultObject
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +// Here we provide a rejection handler which will either throw while debugging
                                                                                                                                                                                                                                                                                                                                                                                                                                                +// or log the exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                +getJsonResult()
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    ->done(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        function ($jsonResultObject) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            // Do something with $jsonResultObject
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        },
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        function (ApiErrorException $exception) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            if (isDebug()) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +                throw $exception;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            } else {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +                logException($exception);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +            }
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        }
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    );
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that if a rejection value is not an instance of \Exception, it will be +wrapped in an exception of the type React\Promise\UnhandledRejectionException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                You can get the original rejection reason by calling $exception->getReason().

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                                This project follows SemVer. -This will install the latest supported version from this branch:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                composer require react/promise:^3.2
                                                                                                                                                                                                                                                                                                                                                                                                                                                +This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer require react/promise:^2.7

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                                                This project aims to run on any platform and thus does not require any PHP -extensions and supports running on PHP 7.1 through current PHP 8+. -It's highly recommended to use the latest supported PHP version for this project.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                We're committed to providing long-term support (LTS) options and to provide a -smooth upgrade path. If you're using an older PHP version, you may use the -2.x branch (PHP 5.4+) or -1.x branch (PHP 5.3+) which both -provide a compatible API but do not take advantage of newer language features. -You may target multiple versions at the same time to support a wider range of -PHP versions like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                composer require "react/promise:^3 || ^2 || ^1"
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                On top of this, we use PHPStan on max level to ensure type safety across the project:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                vendor/bin/phpstan
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Credits

                                                                                                                                                                                                                                                                                                                                                                                                                                                +extensions and supports running on legacy PHP 5.4 through current PHP 7+ and HHVM. +It's highly recommended to use PHP 7+ for this project due to its vast +performance improvements.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Credits

                                                                                                                                                                                                                                                                                                                                                                                                                                                Promise is a port of when.js by Brian Cavalier.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Also, large parts of the documentation have been ported from the when.js Wiki and the API docs.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                License

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +License

                                                                                                                                                                                                                                                                                                                                                                                                                                                Released under the MIT license.

                                                                                                                                                                                                                                                                                                                                                                                                                                              + +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -219,8 +201,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                Promise License

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The MIT License (MIT)

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2012 Jan Sorgalla, Christian Lück, Cees-Jan Kiewiet, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2012-2016 Jan Sorgalla

                                                                                                                                                                                                                                                                                                                                                                                                                                                Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without @@ -246,8 +227,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Promise
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                diff --git a/socket-client/changelog.html b/socket-client/changelog.html deleted file mode 100644 index 3a478f60a..000000000 --- a/socket-client/changelog.html +++ /dev/null @@ -1,946 +0,0 @@ - - - - - - - - SocketClient: Changelog - ReactPHP - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                SocketClient Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2017 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.7.0 - - - (2017-04-02) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / BC break: Add main Connector facade
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#93 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The new Connector class acts as a facade for all underlying connectors,
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -which are now marked as "advanced usage", but continue to work unchanged.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -This now makes it trivially easy to create plaintext TCP/IP, secure TLS and
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Unix domain socket (UDS) connection streams simply like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $connector = new Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector->connect('tls://google.com:443')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $conn->write("GET / HTTP/1.0\r\n\r\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Optionally, it accepts options to configure all underlying connectors, such
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -as using a custom DNS setup, timeout values and disabling certain protocols
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -and much more. See the README for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.6.2 - - - (2017-03-17) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature / Fix: Support SNI on legacy PHP < 5.6 and add documentation for
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -supported PHP and HHVM versions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#90 and #91 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.6.1 - - - (2017-03-10) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Forward compatibility with Stream v0.5 and upcoming v0.6
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#89 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix examples to use updated API
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#88 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.6.0 - - - (2017-02-17) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / BC break: Use connect($uri) instead of create($host, $port)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -and resolve with a ConnectionInterface instead of Stream
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -and expose remote and local addresses through this interface
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -and remove superfluous and undocumented ConnectionException.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#74, #82 and #84 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector->create('google.com', 80)->then(function (Stream $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Connected' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $conn->write("GET / HTTP/1.0\r\n\r\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Connected to ' . $conn->getRemoteAddress() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    $conn->write("GET / HTTP/1.0\r\n\r\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Note that both the old Stream and the new ConnectionInterface implement
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -the same underlying DuplexStreamInterface, so their streaming behavior is
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -actually equivalent.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -In order to upgrade, simply use the new typehints.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Existing stream handlers should continue to work unchanged.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / BC break: All connectors now MUST offer cancellation support.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -You can now rely on getting a rejected promise when calling cancel() on a
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -pending connection attempt.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#79 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old: promise resolution not enforced and thus unreliable
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$promise = $connector->create($host, $port);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$promise->then(/* MAY still be called */, /* SHOULD be called */);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new: rejecting after cancellation is mandatory
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$promise = $connector->connect($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$promise->then(/* MUST NOT be called */, /* MUST be called */);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Note that this behavior is only mandatory for pending connection attempts.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Once the promise is settled (resolved), calling cancel() will have no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC break: All connector classes are now marked final
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -and you can no longer extend them
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(which was never documented or recommended anyway).
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Please use composition instead of extension.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#85 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2016 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.5.3 - - - (2016-12-24) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Fix: Skip IPv6 tests if not supported by the system
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#76 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Documentation for ConnectorInterface
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#77 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.5.2 - - - (2016-12-19) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Replace SecureStream with unlimited read buffer from react/stream v0.4.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#72 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Add examples
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#75 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.4.6 - - - (2016-12-06) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This is a bugfix release that resolves an issue introduced in the v0.4.5 release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -You should consider upgrading to the v0.5 release.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Fix: Always create empty stream context to prevent race condition leading to
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -CN mismatch on TLS enabled connections (#73 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.5.1 - - - (2016-11-20) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support Promise cancellation for all connectors
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#71 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise = $connector->create($host, $port);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add TimeoutConnector decorator
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#51 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $timeout = new TimeoutConnector($connector, 3.0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$timeout->create($host, $port)->then(function(Stream $stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    // connection resolved within 3.0s
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.4.5 - - - (2016-03-27) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This is a compatibility release that backports some changes from the v0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                -release branch. You should consider upgrading to the v0.5 release.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Fix: PHP 5.6+ uses new SSL/TLS context options backported (#65 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Fix: Move SSL/TLS context options to SecureConnector (#43 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.5.0 - - - (2016-03-19) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / BC break: Support Connector without DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#46 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC break: The Connector class now serves as a BC layer only.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -The TcpConnector and DnsConnector classes replace its functionality.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -If you're merely using this class, then you're recommended to upgrade as
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -per the below snippet – existing code will still work unchanged.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -If you're extending the Connector (generally not recommended), then you
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -may have to rework your class hierarchy.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old (still supported, but marked deprecated)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector = new Connector($loop, $resolver);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new equivalent
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector = new DnsConnector(new TcpConnector($loop), $resolver);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new feature: supports connecting to IP addresses only
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector = new TcpConnector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add socket and SSL/TLS context options to connectors
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#52 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: PHP 5.6+ uses new SSL/TLS context options
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#61 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Move SSL/TLS context options to SecureConnector
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#43 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix error reporting for invalid addresses
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#47 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Close stream resource if connection fails
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#48 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  First class support for PHP 5.3 through PHP 7 and HHVM
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#53, #54 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Add integration tests for SSL/TLS sockets
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#62 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2015 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.4.4 - - - (2015-09-23) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Add support for Unix domain sockets (UDS) (#41 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bugfix: Explicitly set supported TLS versions for PHP 5.6+ (#31 by @WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bugfix: Ignore SSL non-draining buffer workaround for PHP 5.6.8+ (#33 by @alexmace)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.4.3 - - - (2015-03-20) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bugfix: Set peer name to hostname to correct security concern in PHP 5.6 (@WyriHaximus)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bugfix: Always wrap secure to pull buffer due to regression in PHP
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bugfix: SecureStream extends Stream to match documentation preventing BC (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2014 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.4.2 - - - (2014-10-16) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Phergilicious: In honour of all the SSL bugs found by the Phergie project re-writing on top of React.

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.4.0 - - - (2014-02-02) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bump React dependencies to v0.4
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2013 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.3.1 - - - (2013-04-20) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: [SocketClient] Support connecting to IPv6 addresses (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 0.3.0 - - - (2013-04-14) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: [SocketClient] New SocketClient component extracted from HttpClient (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - - diff --git a/socket-client/index.html b/socket-client/index.html deleted file mode 100644 index 4d5b7fc3f..000000000 --- a/socket-client/index.html +++ /dev/null @@ -1,959 +0,0 @@ - - - - - - - - SocketClient: SocketClient Component - ReactPHP - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                SocketClient

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                SocketClient Component

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Build Status Code Climate

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Async, streaming plaintext TCP/IP and secure TLS based connections for ReactPHP

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                You can think of this library as an async version of -fsockopen() or -stream_socket_client(). -If you want to transmit and receive data to/from a remote server, you first -have to establish a connection to the remote end. -Establishing this connection through the internet/network may take some time -as it requires several steps (such as resolving target hostname, completing -TCP/IP handshake and enabling TLS) in order to complete. -This component provides an async version of all this so you can establish and -handle multiple connections without blocking.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Table of Contents

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                ConnectorInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The ConnectorInterface is responsible for providing an interface for -establishing streaming connections, such as a normal TCP/IP connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This is the main interface defined in this package and it is used throughout -React's vast ecosystem.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Most higher-level components (such as HTTP, database or other networking -service clients) accept an instance implementing this interface to create their -TCP/IP connection to the underlying networking service. -This is usually done via dependency injection, so it's fairly simple to actually -swap this implementation against any other implementation of this interface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The interface only offers a single method:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                connect()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The connect(string $uri): PromiseInterface<ConnectionInterface, Exception> method -can be used to create a streaming connection to the given remote address.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                It returns a Promise which either -fulfills with a stream implementing ConnectionInterface -on success or rejects with an Exception if the connection is not successful:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector->connect('google.com:443')->then(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // connection successfully established
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    function (Exception $error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        // failed to connect due to $error
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                                -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also ConnectionInterface for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The returned Promise MUST be implemented in such a way that it can be -cancelled when it is still pending. Cancelling a pending promise MUST -reject its value with an Exception. It SHOULD clean up any underlying -resources and references as applicable:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = $connector->connect($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                ConnectionInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The ConnectionInterface is used to represent any outgoing connection, -such as a normal TCP/IP connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                An outgoing connection is a duplex stream (both readable and writable) that -implements React's -DuplexStreamInterface. -It contains additional properties for the local and remote address -where this connection has been established to.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Most commonly, instances implementing this ConnectionInterface are returned -by all classes implementing the ConnectorInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that this interface is only to be used to represent the client-side end -of an outgoing connection. -It MUST NOT be used to represent an incoming connection in a server-side context. -If you want to accept incoming connections, -use the Socket component instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Because the ConnectionInterface implements the underlying -DuplexStreamInterface -you can use any of its events and methods as usual:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connection->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'ended';
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'error: ' . $e->getMessage();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'closed';
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->write($data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->end($data = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -// …
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                For more details, see the -DuplexStreamInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                getRemoteAddress()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The getRemoteAddress(): ?string method can be used to -return the remote address (IP and port) where this connection has been -established to.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $connection->getRemoteAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -echo 'Connected to ' . $address . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the remote address can not be determined or is unknown at this time (such as -after the connection has been closed), it MAY return a NULL value instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Otherwise, it will return the full remote address as a string value. -If this is a TCP/IP based connection and you only want the remote IP, you may -use something like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $connection->getRemoteAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$ip = trim(parse_url('tcp://' . $address, PHP_URL_HOST), '[]');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -echo 'Connected to ' . $ip . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                getLocalAddress()

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The getLocalAddress(): ?string method can be used to -return the full local address (IP and port) where this connection has been -established from.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $connection->getLocalAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -echo 'Connected via ' . $address . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the local address can not be determined or is unknown at this time (such as -after the connection has been closed), it MAY return a NULL value instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Otherwise, it will return the full local address as a string value.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This method complements the getRemoteAddress() method, -so they should not be confused.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                If your system has multiple interfaces (e.g. a WAN and a LAN interface), -you can use this method to find out which interface was actually -used for this connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Connector

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The Connector class is the main class in this package that implements the -ConnectorInterface and allows you to create streaming connections.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                You can use this connector to create any kind of streaming connections, such -as plaintext TCP/IP, secure TLS or local Unix connection streams.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                It binds to the main event loop and can be used like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector = new Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector->connect($uri)->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to create a plaintext TCP/IP connection, you can simply pass a host -and port combination like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector->connect('www.google.com:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                If you do no specify a URI scheme in the destination URI, it will assume -tcp:// as a default and establish a plaintext TCP/IP connection. -Note that TCP/IP connections require a host and port part in the destination -URI like above, all other URI components are optional.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to create a secure TLS connection, you can use the tls:// URI scheme -like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector->connect('tls://www.google.com:443')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to create a local Unix domain socket connection, you can use the -unix:// URI scheme like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector->connect('unix:///tmp/demo.sock')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Under the hood, the Connector is implemented as a higher-level facade -for the lower-level connectors implemented in this package. This means it -also shares all of their features and implementation details. -If you want to typehint in your higher-level protocol implementation, you SHOULD -use the generic ConnectorInterface instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                In particular, the Connector class uses Google's public DNS server 8.8.8.8 -to resolve all hostnames into underlying IP addresses by default. -This implies that it also ignores your hosts file and resolve.conf, which -means you won't be able to connect to localhost and other non-public -hostnames by default. -If you want to use a custom DNS server (such as a local DNS relay), you can set -up the Connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'dns' => '127.0.1.1'
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector->connect('localhost:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                If you do not want to use a DNS resolver at all and want to connect to IP -addresses only, you can also set up your Connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'dns' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector->connect('127.0.0.1:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced: If you need a custom DNS Resolver instance, you can also set up -your Connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$resolver = $dnsResolverFactory->createCached('127.0.1.1', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'dns' => $resolver
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector->connect('localhost:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, the tcp:// and tls:// URI schemes will use timeout value that -repects your default_socket_timeout ini setting (which defaults to 60s). -If you want a custom timeout value, you can simply pass this like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'timeout' => 10.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Similarly, if you do not want to apply a timeout at all and let the operating -system handle this, you can pass a boolean flag like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'timeout' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, the Connector supports the tcp://, tls:// and unix:// -URI schemes. If you want to explicitly prohibit any of these, you can simply -pass boolean flags like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                // only allow secure TLS connections
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tcp' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tls' => true,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'unix' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector->connect('tls://google.com:443')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The tcp:// and tls:// also accept additional context options passed to -the underlying connectors. -If you want to explicitly pass additional context options, you can simply -pass arrays of context options like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                // allow insecure TLS connections
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tcp' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'bindto' => '192.168.0.1:0'
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'verify_peer' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'verify_peer_name' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector->connect('tls://localhost:443')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                For more details about context options, please refer to the PHP documentation -about socket context options -and SSL context options.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced: By default, the Connector supports the tcp://, tls:// and -unix:// URI schemes. -For this, it sets up the required connector classes automatically. -If you want to explicitly pass custom connectors for any of these, you can simply -pass an instance implementing the ConnectorInterface like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$resolver = $dnsResolverFactory->createCached('127.0.1.1', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$tcp = new DnsConnector(new TcpConnector($loop), $resolver);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$tls = new SecureConnector($tcp, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$unix = new UnixConnector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tcp' => $tcp,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tls' => $tls,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'unix' => $unix,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'dns' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'timeout' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector->connect('google.com:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Internally, the tcp:// connector will always be wrapped by the DNS resolver, -unless you disable DNS like in the above example. In this case, the tcp:// -connector receives the actual hostname instead of only the resolved IP address -and is thus responsible for performing the lookup. -Internally, the automatically created tls:// connector will always wrap the -underlying tcp:// connector for establishing the underlying plaintext -TCP/IP connection before enabling secure TLS mode. If you want to use a custom -underlying tcp:// connector for secure TLS connections only, you may -explicitly pass a tls:// connector like above instead. -Internally, the tcp:// and tls:// connectors will always be wrapped by -TimeoutConnector, unless you disable timeouts like in the above example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced Usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                TcpConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The React\SocketClient\TcpConnector class implements the -ConnectorInterface and allows you to create plaintext -TCP/IP connections to any IP-port-combination:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $tcpConnector = new React\SocketClient\TcpConnector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$tcpConnector->connect('127.0.0.1:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the first example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Pending connection attempts can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = $tcpConnector->connect('127.0.0.1:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Calling cancel() on a pending promise will close the underlying socket -resource, thus cancelling the pending TCP/IP connection, and reject the -resulting promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                You can optionally pass additional -socket context options -to the constructor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $tcpConnector = new React\SocketClient\TcpConnector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'bindto' => '192.168.0.1:0'
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that this class only allows you to connect to IP-port-combinations. -If the given URI is invalid, does not contain a valid IP address and port -or contains any other scheme, it will reject with an -InvalidArgumentException:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the given URI appears to be valid, but connecting to it fails (such as if -the remote host rejects the connection etc.), it will reject with a -RuntimeException.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to connect to hostname-port-combinations, see also the following chapter.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced usage: Internally, the TcpConnector allocates an empty context -resource for each stream resource. -If the destination URI contains a hostname query parameter, its value will -be used to set up the TLS peer name. -This is used by the SecureConnector and DnsConnector to verify the peer -name and can also be used if you want a custom TLS peer name.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                DnsConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The DnsConnector class implements the -ConnectorInterface and allows you to create plaintext -TCP/IP connections to any hostname-port-combination.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                It does so by decorating a given TcpConnector instance so that it first -looks up the given domain name via DNS (if applicable) and then establishes the -underlying TCP/IP connection to the resolved target IP address.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Make sure to set up your DNS resolver and underlying TCP connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$dns = $dnsResolverFactory->createCached('8.8.8.8', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$dnsConnector = new React\SocketClient\DnsConnector($tcpConnector, $dns);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$dnsConnector->connect('www.google.com:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the first example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Pending connection attempts can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = $dnsConnector->connect('www.google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Calling cancel() on a pending promise will cancel the underlying DNS lookup -and/or the underlying TCP/IP connection and reject the resulting promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced usage: Internally, the DnsConnector relies on a Resolver to -look up the IP address for the given hostname. -It will then replace the hostname in the destination URI with this IP and -append a hostname query parameter and pass this updated URI to the underlying -connector. -The underlying connector is thus responsible for creating a connection to the -target IP address, while this query parameter can be used to check the original -hostname and is used by the TcpConnector to set up the TLS peer name. -If a hostname is given explicitly, this query parameter will not be modified, -which can be useful if you want a custom TLS peer name.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                SecureConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The SecureConnector class implements the -ConnectorInterface and allows you to create secure -TLS (formerly known as SSL) connections to any hostname-port-combination.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                It does so by decorating a given DnsConnector instance so that it first -creates a plaintext TCP/IP connection and then enables TLS encryption on this -stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $secureConnector = new React\SocketClient\SecureConnector($dnsConnector, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$secureConnector->connect('www.google.com:443')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write("GET / HTTP/1.0\r\nHost: www.google.com\r\n\r\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    ...
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the second example.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Pending connection attempts can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = $secureConnector->connect('www.google.com:443');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Calling cancel() on a pending promise will cancel the underlying TCP/IP -connection and/or the SSL/TLS negonation and reject the resulting promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                You can optionally pass additional -SSL context options -to the constructor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $secureConnector = new React\SocketClient\SecureConnector($dnsConnector, $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'verify_peer' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'verify_peer_name' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced usage: Internally, the SecureConnector relies on setting up the -required context options on the underlying stream resource. -It should therefor be used with a TcpConnector somewhere in the connector -stack so that it can allocate an empty context resource for each stream -resource and verify the peer name. -Failing to do so may result in a TLS peer name mismatch error or some hard to -trace race conditions, because all stream resources will use a single, shared -default context resource otherwise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                TimeoutConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The TimeoutConnector class implements the -ConnectorInterface and allows you to add timeout -handling to any existing connector instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                It does so by decorating any given ConnectorInterface -instance and starting a timer that will automatically reject and abort any -underlying connection attempt if it takes too long.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $timeoutConnector = new React\SocketClient\TimeoutConnector($connector, 3.0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$timeoutConnector->connect('google.com:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    // connection succeeded within 3.0 seconds
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also any of the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Pending connection attempts can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $promise = $timeoutConnector->connect('google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Calling cancel() on a pending promise will cancel the underlying connection -attempt, abort the timer and reject the resulting promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                UnixConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The UnixConnector class implements the -ConnectorInterface and allows you to connect to -Unix domain socket (UDS) paths like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector = new React\SocketClient\UnixConnector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector->connect('/tmp/demo.sock')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write("HELLO\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Connecting to Unix domain sockets is an atomic operation, i.e. its promise will -settle (either resolve or reject) immediately. -As such, calling cancel() on the resulting promise has no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Install

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The recommended way to install this library is through Composer. -New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer require react/socket-client:^0.7
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                More details about version upgrades can be found in the CHANGELOG.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This project supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. -It's highly recommended to use PHP 7+ for this project, partly due to its vast -performance improvements and partly because legacy PHP versions require several -workarounds as described below.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Secure TLS connections received some major upgrades starting with PHP 5.6, with -the defaults now being more secure, while older versions required explicit -context options. -This library does not take responsibility over these context options, so it's -up to consumers of this library to take care of setting appropriate context -options as described above.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                All versions of PHP prior to 5.6.8 suffered from a buffering issue where reading -from a streaming TLS connection could be one data event behind. -This library implements a work-around to try to flush the complete incoming -data buffers on these versions, but we have seen reports of people saying this -could still affect some older versions (5.5.23, 5.6.7, and 5.6.8). -Note that this only affects some higher-level streaming protocols, such as -IRC over TLS, but should not affect HTTP over TLS (HTTPS). -Further investigation of this issue is needed. -For more insights, this issue is also covered by our test suite.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This project also supports running on HHVM. -Note that really old HHVM < 3.8 does not support secure TLS connections, as it -lacks the required stream_socket_enable_crypto() function. -As such, trying to create a secure TLS connections on affected versions will -return a rejected promise instead. -This issue is also covered by our test suite, which will skip related tests -on affected versions.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $ composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $ php vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                License

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - - diff --git a/socket-client/license.html b/socket-client/license.html deleted file mode 100644 index e19099a1b..000000000 --- a/socket-client/license.html +++ /dev/null @@ -1,460 +0,0 @@ - - - - - - - - SocketClient: License - ReactPHP - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                SocketClient License

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Copyright (c) 2012 Igor Wiedler, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - - diff --git a/socket/changelog.html b/socket/changelog.html index b9c342342..c1728d3fc 100644 --- a/socket/changelog.html +++ b/socket/changelog.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -41,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                              • -
                                                                                                                                                                                                                                                                                                                                                                                                                                              • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -221,14 +203,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2025 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.17.0 - - - (2025-11-19) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2024 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.16.0 - - - (2024-07-26) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#318 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2023 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.15.0 - - - (2023-12-15) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Full PHP 8.3 compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#310 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix cancelling during the 50ms resolution delay when DNS is still pending.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#311 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.14.0 - - - (2023-08-25) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve Promise v3 support and use template types.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#307 and #309 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite and update to collect all garbage cycles.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#308 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.13.0 - - - (2023-06-07) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Include timeout logic to avoid dependency on reactphp/promise-timer.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#305 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve errno detection for failed connections without ext-sockets.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#304 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, clean up leftover .sock files and report failed assertions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#299, #300, #301 and #306 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2022 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.12.0 - - - (2022-08-25) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Forward compatibility with react/promise 3.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#214 by @WyriHaximus and @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Full support for PHP 8.2 release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#298 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Avoid unneeded syscall on socket close.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#292 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix: Improve error reporting when custom error handler is used.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#290 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix invalid references in exception stack trace.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#284 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Minor documentation improvements, update to use new reactphp/async package instead of clue/reactphp-block.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#296 by @clue, #285 by @SimonFrings and #295 by @nhedger)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, update macOS and HHVM environment, fix optional tests for ENETUNREACH.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#288, #289 and #297 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.11.0 - - - (2022-01-14) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Full support for PHP 8.1 release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#277 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Avoid dependency on ext-filter.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#279 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite to skip FD test when hitting memory limit
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -and skip legacy TLS 1.0 tests if disabled by system.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#278 and #281 by @clue and #283 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2021 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.10.0 - - - (2021-11-29) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support listening on existing file descriptors (FDs) with SocketServer.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#269 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $socket = new React\Socket\SocketSever('php://fd/3');
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  This is particularly useful when using systemd socket activation like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $ systemd-socket-activate -l 8000 php examples/03-http-server.php php://fd/3
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve error messages for failed connection attempts with errno and errstr.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#265, #266, #267, #270 and #271 by @clue and #268 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  All error messages now always include the appropriate errno and errstr to
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -give more details about the error reason when available. Along with these
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -error details exposed by the underlying system functions, it will also
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -include the appropriate error constant name (such as ECONNREFUSED) when
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -available. Accordingly, failed TCP/IP connections will now report the actual
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -underlying error condition instead of a generic "Connection refused" error.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Higher-level error messages will now consistently report the connection URI
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -scheme and hostname used in all error messages.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  For most common use cases this means that simply reporting the Exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -message should give the most relevant details for any connection issues:

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $connector = new React\Socket\Connector();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector->connect($uri)->then(function (React\Socket\ConnectionInterface $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    // …
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo 'Error:' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, test against PHP 8.1 release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#274 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.9.0 - - - (2021-08-03) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add new SocketServer and deprecate Server to avoid class name collisions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#263 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The new SocketServer class has been added with an improved constructor signature
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -as a replacement for the previous Server class in order to avoid any ambiguities.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -The previous name has been deprecated and should not be used anymore.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -In its most basic form, the deprecated Server can now be considered an alias for new SocketServer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  // deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$socket = new React\Socket\Server(0);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$socket = new React\Socket\Server('127.0.0.1:8000');
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$socket = new React\Socket\Server('127.0.0.1:8000', null, $context);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$socket = new React\Socket\Server('127.0.0.1:8000', $loop, $context);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$socket = new React\Socket\SocketServer('127.0.0.1:0');
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$socket = new React\Socket\SocketServer('127.0.0.1:8000');
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$socket = new React\Socket\SocketServer('127.0.0.1:8000', $context);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$socket = new React\Socket\SocketServer('127.0.0.1:8000', $context, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Update Connector signature to take optional $context as first argument.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#264 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The new signature has been added to match the new SocketServer and
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -consistently move the now commonly unneeded loop argument to the last argument.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -The previous signature has been deprecated and should not be used anymore.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -In its most basic form, both signatures are compatible.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                   // deprecated
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector = new React\Socket\Connector(null, $context);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector = new React\Socket\Connector($loop, $context);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector = new React\Socket\Connector($context);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector = new React\Socket\Connector($context, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.8.0 - - - (2021-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Simplify usage by supporting new default loop.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#260 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old (still supported)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector = new React\Socket\Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new (using default loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$socket = new React\Socket\Server('127.0.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$connector = new React\Socket\Connector();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.7.0 - - - (2021-06-25) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support falling back to multiple DNS servers from DNS config.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#257 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  If you're using the default Connector, it will now use all DNS servers
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -configured on your system. If you have multiple DNS servers configured and
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -connectivity to the primary DNS server is broken, it will now fall back to
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -your other DNS servers, thus providing improved connectivity and redundancy
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -for broken DNS configurations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Use round robin for happy eyeballs DNS responses (load balancing).
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#247 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  If you're using the default Connector, it will now randomize the order of
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -the IP addresses resolved via DNS when connecting. This allows the load to
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -be distributed more evenly across all returned IP addresses. This can be
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -used as a very basic DNS load balancing mechanism.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Internal improvement to avoid unhandled rejection for future Promise API.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#258 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, use GitHub actions for continuous integration (CI).
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#254 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2020 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.6.0 - - - (2020-08-28) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Support upcoming PHP 8 release.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#246 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Change default socket backlog size to 511.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#242 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix closing connection when cancelling during TLS handshake.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#241 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Fix blocking during possible accept() race condition
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -when multiple socket servers listen on same socket address.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#244 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, update PHPUnit config and add full core team to the license.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#243 by @SimonFrings and #245 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.5.0 - - - (2020-07-01) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix: Improve error handling and reporting for happy eyeballs and
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -immediately try next connection when one connection attempt fails.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#230, #231, #232 and #233 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Error messages for failed connection attempts now include more details to
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -ease debugging. Additionally, the happy eyeballs algorithm has been improved
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -to avoid having to wait for some timers to expire which significantly
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -improves connection setup times (in particular when IPv6 isn't available).

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite, minor code cleanup and improve code coverage to 100%.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Update to PHPUnit 9 and skip legacy TLS 1.0 / TLS 1.1 tests if disabled by
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -system. Run tests on Windows and simplify Travis CI test matrix for Mac OS X
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -setup and skip all TLS tests on legacy HHVM.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#229, #235, #236 and #238 by @clue and #239 by @SimonFrings)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.4.0 - - - (2020-03-12) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add IPv6 support to Connector (implement "Happy Eyeballs" algorithm to support IPv6 probing).
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -IPv6 support is turned on by default, use new happy_eyeballs option in Connector to toggle behavior.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#196, #224 and #225 by @WyriHaximus and @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Default to using DNS cache (with max 256 entries) for Connector.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#226 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Add .gitattributes to exclude dev files from exports and some minor code style fixes.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#219 by @reedy and #218 by @mmoreram)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite to fix failing test cases when using new DNS component,
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -significantly improve test performance by awaiting events instead of sleeping,
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -exclude TLS 1.3 test on PHP 7.3, run tests on PHP 7.4 and simplify test matrix.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#208, #209, #210, #217 and #223 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - 2019 -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.3.0 - - - (2019-07-10) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Forward compatibility with upcoming stable DNS component.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#206 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.2.1 - - - (2019-06-03) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Avoid uneeded fragmented TLS work around for PHP 7.3.3+ and
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -work around failing test case detecting EOF on TLS 1.3 socket streams.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#201 and #202 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve TLS certificate/passphrase example.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#190 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.2.0 - - - (2019-01-07) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix: Improve TLS 1.3 support.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#186 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  TLS 1.3 is now an official standard as of August 2018! 🎉
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -The protocol has major improvements in the areas of security, performance, and privacy.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -TLS 1.3 is supported by default as of OpenSSL 1.1.1.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -For example, this version ships with Ubuntu 18.10 (and newer) by default, meaning that recent installations support TLS 1.3 out of the box :shipit:

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Avoid possibility of missing remote address when TLS handshake fails.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#188 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve performance by prefixing all global functions calls with \ to skip the look up and resolve process and go straight to the global function.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#183 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Update documentation to use full class names with namespaces.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#187 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite to avoid some possible race conditions,
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -test against PHP 7.3 on Travis and
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -use dedicated assertInstanceOf() assertions.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#185 by @clue, #178 by @WyriHaximus and #181 by @carusogabriel)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                2018

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - - - 1.1.0 - - - (2018-10-01) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Improve error reporting for failed connection attempts and improve
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -cancellation forwarding during DNS lookup, TCP/IP connection or TLS handshake.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#168, #169, #170, #171, #176 and #177 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  All error messages now always contain a reference to the remote URI to give
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -more details which connection actually failed and the reason for this error.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -Accordingly, failures during DNS lookup will now mention both the remote URI
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -as well as the DNS error reason. TCP/IP connection issues and errors during
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -a secure TLS handshake will both mention the remote URI as well as the
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -underlying socket error. Similarly, lost/dropped connections during a TLS
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -handshake will now report a lost connection instead of an empty error reason.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  For most common use cases this means that simply reporting the Exception
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -message should give the most relevant details for any connection issues:

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $promise = $connector->connect('tls://example.com:443');
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$promise->then(function (ConnectionInterface $conn) use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    // …
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -    echo $e->getMessage();
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                - -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -909,14 +230,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • First stable LTS release, now following SemVer.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    We'd like to emphasize that this component is production ready and battle-tested.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    We plan to support all long-term support (LTS) releases for at least 24 months,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    so you have a rock-solid foundation to build on top of.
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Contains no other changes, so it's actually fully compatible with the v0.8.12 release.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Contains no other changes, so it's actually fully compatible with the v0.8.12 release.


                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -934,14 +255,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Improve memory consumption for failed and cancelled connection attempts.
                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#161 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Improve memory consumption for failed and cancelled connection attempts.
                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#161 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite to fix Travis config to test against legacy PHP 5.3 again.
                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#162 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite to fix Travis config to test against legacy PHP 5.3 again.
                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#162 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -960,10 +281,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Feature: Improve memory consumption for cancelled connection attempts and
                                                                                                                                                                                                                                                                                                                                                                                                                                                        simplify skipping DNS lookup when connecting to IP addresses.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#159 and #160 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +(#159 and #160 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -981,19 +302,19 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature: Update DNS dependency to support loading system default DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature: Update DNS dependency to support loading system default DNS
                                                                                                                                                                                                                                                                                                                                                                                                                                                          nameserver config on all supported platforms
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(/etc/resolv.conf on Unix/Linux/Mac/Docker/WSL and WMIC on Windows)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#152 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This means that connecting to hosts that are managed by a local DNS server,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(/etc/resolv.conf on Unix/Linux/Mac/Docker/WSL and WMIC on Windows)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#152 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                          This means that connecting to hosts that are managed by a local DNS server,
                                                                                                                                                                                                                                                                                                                                                                                                                                                          such as a corporate DNS server or when using Docker containers, will now
                                                                                                                                                                                                                                                                                                                                                                                                                                                          work as expected across all platforms with no changes required:

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $connector = new Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$connector->connect('intranet.example:80')->then(function ($connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    // …
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          $connector = new Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$connector->connect('intranet.example:80')->then(function ($connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    //
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1012,24 +333,24 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support explicitly choosing TLS version to negotiate with remote side
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -by respecting crypto_method context parameter for all classes.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#149 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            By default, all connector and server classes support TLSv1.0+ and exclude
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Support explicitly choosing TLS version to negotiate with remote side
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +by respecting crypto_method context parameter for all classes.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#149 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            By default, all connector and server classes support TLSv1.0+ and exclude
                                                                                                                                                                                                                                                                                                                                                                                                                                                            support for legacy SSLv2/SSLv3. As of PHP 5.6+ you can also explicitly
                                                                                                                                                                                                                                                                                                                                                                                                                                                            choose the TLS version you want to negotiate with the remote side:

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            // new: now supports 'crypto_method` context parameter for all classes
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -$connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            // new: now supports 'crypto_method` context parameter for all classes
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +$connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Minor internal clean up to unify class imports
                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#148 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                            Minor internal clean up to unify class imports
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#148 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1048,10 +369,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Improve test suite by adding test group to skip integration tests relying on
                                                                                                                                                                                                                                                                                                                                                                                                                                                              internet connection and fix minor documentation typo.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#146 by @clue and #145 by @cn007b)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +(#146 by @clue and #145 by @cn007b)

                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1074,17 +395,17 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Fix closing socket resource before removing from loop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#141 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This fixes the root cause of an uncaught Exception that only manifested
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fix: Fix closing socket resource before removing from loop
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#141 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                This fixes the root cause of an uncaught Exception that only manifested
                                                                                                                                                                                                                                                                                                                                                                                                                                                                itself after the recent Stream v0.7.4 component update and only if you're
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -using ext-event (ExtEventLoop).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +using ext-event (ExtEventLoop).

                                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite by testing against PHP 7.2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#140 by @carusogabriel)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Improve test suite by testing against PHP 7.2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#140 by @carusogabriel)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1103,25 +424,25 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add Unix domain socket (UDS) support to Server with unix:// URI scheme
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -and add advanced UnixServer class.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#120 by @andig)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // new: Server now supports "unix://" scheme
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$server = new Server('unix:///tmp/server.sock', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new: advanced usage
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$server = new UnixServer('/tmp/server.sock', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add Unix domain socket (UDS) support to Server with unix:// URI scheme
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +and add advanced UnixServer class.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#120 by @andig)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // new: Server now supports "unix://" scheme
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$server = new Server('unix:///tmp/server.sock', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +// new: advanced usage
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$server = new UnixServer('/tmp/server.sock', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Restructure examples to ease getting started
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#136 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Restructure examples to ease getting started
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#136 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite by adding forward compatibility with PHPUnit 6 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite by adding forward compatibility with PHPUnit 6 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ignore Mac OS X test failures for now until Travis tests work again
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#133 by @Gabriel-Caruso and #134 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#133 by @gabriel-caruso and #134 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1140,24 +461,24 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Work around PHP bug with Unix domain socket (UDS) paths for Mac OS X
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#123 by @andig)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Work around PHP bug with Unix domain socket (UDS) paths for Mac OS X
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#123 by @andig)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Fix SecureServer to return null URI if server socket is already closed
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#129 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Fix SecureServer to return null URI if server socket is already closed
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#129 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve test suite by adding forward compatibility with PHPUnit v5 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve test suite by adding forward compatibility with PHPUnit v5 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    forward compatibility with upcoming EventLoop releases in tests and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    test Mac OS X on Travis
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#122 by @andig and #125, #127 and #130 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#122 by @andig and #125, #127 and #130 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Readme improvements
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#118 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Readme improvements
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#118 by @jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1176,20 +497,20 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Add FixedUriConnector decorator to use fixed, preconfigured URI instead
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#117 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      This can be useful for consumers that do not support certain URIs, such as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Add FixedUriConnector decorator to use fixed, preconfigured URI instead
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#117 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      This can be useful for consumers that do not support certain URIs, such as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      when you want to explicitly connect to a Unix domain socket (UDS) path
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      instead of connecting to a default address assumed by an higher-level API:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $connector = new FixedUriConnector(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -    'unix:///var/run/docker.sock',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -    new UnixConnector($loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -// destination will be ignored, actually connects to Unix domain socket
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$promise = $connector->connect('localhost:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $connector = new FixedUriConnector(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +    'unix:///var/run/docker.sock',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +    new UnixConnector($loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +// destination will be ignored, actually connects to Unix domain socket
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$promise = $connector->connect('localhost:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1208,14 +529,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Reduce memory consumption for failed connections
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#113 by @valga)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature: Reduce memory consumption for failed connections
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#113 by @valga)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Fix: Work around write chunk size for TLS streams for PHP < 7.1.14
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#114 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Fix: Work around write chunk size for TLS streams for PHP < 7.1.14
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#114 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1234,16 +555,16 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature: Update DNS dependency to support hosts file on all platforms
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#112 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          This means that connecting to hosts such as localhost will now work as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature: Update DNS dependency to support hosts file on all platforms
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#112 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          This means that connecting to hosts such as localhost will now work as
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          expected across all platforms with no changes required:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          $connector = new Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$connector->connect('localhost:8080')->then(function ($connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -    // …
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          $connector = new Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$connector->connect('localhost:8080')->then(function ($connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +    //
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1262,20 +583,20 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Forward compatibility with upcoming EventLoop v1.0 and v0.5 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Forward compatibility with upcoming EventLoop v1.0 and v0.5 and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            target evenement 3.0 a long side 2.0 and 1.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#104 by @clue and #111 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#104 by @clue and #111 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite by locking Travis distro so new defaults will not break the build and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite by locking Travis distro so new defaults will not break the build and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            fix HHVM build for now again and ignore future HHVM build errors
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#109 and #110 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#109 and #110 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Minor documentation fixes
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#103 by @christiaan and #108 by @hansott)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Minor documentation fixes
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#103 by @christiaan and #108 by @hansott)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1294,31 +615,31 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Feature: New Server class now acts as a facade for existing server classes
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -and renamed old Server to TcpServer for advanced usage.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#96 and #97 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The Server class is now the main class in this package that implements the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -ServerInterface and allows you to accept incoming streaming connections,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Feature: New Server class now acts as a facade for existing server classes
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +and renamed old Server to TcpServer for advanced usage.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#96 and #97 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The Server class is now the main class in this package that implements the
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +ServerInterface and allows you to accept incoming streaming connections,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              such as plaintext TCP/IP or secure TLS connection streams.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              This is not a BC break and consumer code does not have to be updated.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              This is not a BC break and consumer code does not have to be updated.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Feature / BC break: All addresses are now URIs that include the URI scheme
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#98 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              - $parts = parse_url('tcp://' . $conn->getRemoteAddress());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Feature / BC break: All addresses are now URIs that include the URI scheme
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#98 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              - $parts = parse_url('tcp://' . $conn->getRemoteAddress());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                               + $parts = parse_url($conn->getRemoteAddress());
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Fix: Fix unix:// addresses for Unix domain socket (UDS) paths
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#100 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Fix: Fix unix:// addresses for Unix domain socket (UDS) paths
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#100 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Feature: Forward compatibility with Stream v1.0 and v0.7
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#99 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Feature: Forward compatibility with Stream v1.0 and v0.7
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#99 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1337,9 +658,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Fix: Work around latest PHP 7.0.18 and 7.1.4 no longer accepting full URIs
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#94 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +(#94 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1357,9 +678,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Fix: Ignore HHVM errors when closing connection that is already closing
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#91 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +(#91 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1377,34 +698,34 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Merge SocketClient component into this component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#87 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This means that this package now provides async, streaming plaintext TCP/IP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Merge SocketClient component into this component
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#87 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    This means that this package now provides async, streaming plaintext TCP/IP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    and secure TLS socket server and client connections for ReactPHP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    $connector = new React\Socket\Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    $connection->write('');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Accordingly, the ConnectionInterface is now used to represent both incoming
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    $connector = new React\Socket\Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    $connection->write('');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Accordingly, the ConnectionInterface is now used to represent both incoming
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    server side connections as well as outgoing client side connections.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    If you've previously used the SocketClient component to establish outgoing
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    If you've previously used the SocketClient component to establish outgoing
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    client connections, upgrading should take no longer than a few minutes.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -All classes have been merged as-is from the latest v0.7.0 release with no
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +All classes have been merged as-is from the latest v0.7.0 release with no
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    other changes, so you can simply update your code to use the updated namespace
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    // old from SocketClient component and namespace
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -$connector = new React\SocketClient\Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    $connection->write('');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -$connector = new React\Socket\Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    $connection->write('');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    // old from SocketClient component and namespace
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +$connector = new React\SocketClient\Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    $connection->write('');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +$connector = new React\Socket\Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    $connection->write('');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1423,28 +744,28 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Add LimitingServer to limit and keep track of open connections
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#86 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $server = new Server(0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$server = new LimitingServer($server, 100);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -    …
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature: Add LimitingServer to limit and keep track of open connections
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#86 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $server = new Server(0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$server = new LimitingServer($server, 100);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / BC break: Add pause() and resume() methods to limit active
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Feature / BC break: Add pause() and resume() methods to limit active
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      connections
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#84 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $server = new Server(0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$server->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -$loop->addTimer(1.0, function() use ($server) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -    $server->resume();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#84 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      $server = new Server(0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$server->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +$loop->addTimer(1.0, function() use ($server) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +    $server->resume();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1463,9 +784,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Feature: Forward compatibility with Stream v0.5 and upcoming v0.6
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#79 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +(#79 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1483,83 +804,83 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Feature / BC break: Replace listen() call with URIs passed to constructor
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -and reject listening on hostnames with InvalidArgumentException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -and replace ConnectionException with RuntimeException for consistency
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#61, #66 and #72 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server = new Server($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server->listen(8080);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -$server = new Server(8080, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Similarly, you can now pass a full listening URI to the constructor to change
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: Replace listen() call with URIs passed to constructor
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +and reject listening on hostnames with InvalidArgumentException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +and replace ConnectionException with RuntimeException for consistency
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#61, #66 and #72 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server = new Server($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server->listen(8080);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server = new Server(8080, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Similarly, you can now pass a full listening URI to the constructor to change
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          the listening host:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server = new Server($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server->listen(8080, '127.0.0.1');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server = new Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Trying to start listening on (DNS) host names will now throw an
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -InvalidArgumentException, use IP addresses instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server = new Server($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server->listen(8080, 'localhost');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server = new Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          If trying to listen fails (such as if port is already in use or port below
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -1024 may require root access etc.), it will now throw a RuntimeException,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -the ConnectionException class has been removed:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old: throws React\Socket\ConnectionException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server = new Server($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server->listen(80);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -// new: throws RuntimeException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server = new Server(80, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: Rename shutdown() to close() for consistency throughout React
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#62 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server->shutdown();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -$server->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: Replace getPort() with getAddress()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#67 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -echo $server->getPort(); // 8080
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -echo $server->getAddress(); // 127.0.0.1:8080
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: getRemoteAddress() returns full address instead of only IP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#65 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -echo $connection->getRemoteAddress(); // 192.168.0.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -echo $connection->getRemoteAddress(); // 192.168.0.1:51743
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: Add getLocalAddress() method
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#68 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          echo $connection->getLocalAddress(); // 127.0.0.1:8080
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          BC break: The Server and SecureServer class are now marked final
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -and you can no longer extend them
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server = new Server($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server->listen(8080, '127.0.0.1');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server = new Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Trying to start listening on (DNS) host names will now throw an
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +InvalidArgumentException, use IP addresses instead:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server = new Server($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server->listen(8080, 'localhost');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server = new Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          If trying to listen fails (such as if port is already in use or port below
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +1024 may require root access etc.), it will now throw a RuntimeException,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +the ConnectionException class has been removed:

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old: throws React\Socket\ConnectionException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server = new Server($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server->listen(80);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +// new: throws RuntimeException
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server = new Server(80, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: Rename shutdown() to close() for consistency throughout React
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#62 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server->shutdown();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +$server->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: Replace getPort() with getAddress()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#67 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +echo $server->getPort(); // 8080
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +echo $server->getAddress(); // 127.0.0.1:8080
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: getRemoteAddress() returns full address instead of only IP
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#65 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +echo $connection->getRemoteAddress(); // 192.168.0.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +echo $connection->getRemoteAddress(); // 192.168.0.1:51743
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Feature / BC break: Add getLocalAddress() method
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#68 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          echo $connection->getLocalAddress(); // 127.0.0.1:8080
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          BC break: The Server and SecureServer class are now marked final
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +and you can no longer extend them
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          (which was never documented or recommended anyway).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Public properties and event handlers are now internal only.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Please use composition instead of extension.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#71, #70 and #69 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#71, #70 and #69 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1578,13 +899,13 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Feature: Support socket context options passed to Server
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#64 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Fix: Properly return null for unknown addresses
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#63 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Improve documentation for ServerInterface and lock test suite requirements
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#60 by @clue, #57 by @shaunbramley)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Feature: Support socket context options passed to Server
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#64 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Fix: Properly return null for unknown addresses
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#63 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Improve documentation for ServerInterface and lock test suite requirements
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#60 by @clue, #57 by @shaunbramley)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1602,11 +923,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Feature: Add SecureServer for secure TLS connections
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#55 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Feature: Add SecureServer for secure TLS connections
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +(#55 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Add functional integration tests
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#54 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +(#54 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1629,13 +950,13 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Feature / Fix: ConnectionInterface should extend DuplexStreamInterface + documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#50 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature / Fix: ConnectionInterface should extend DuplexStreamInterface + documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#50 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature / Fix: Improve test suite and switch to normal stream handler
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#51 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +(#51 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: Add examples
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#49 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • +(#49 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1653,7 +974,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Suppress errors on stream_socket_accept to prevent PHP from crashing
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Support for PHP7 and HHVM
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Support PHP 5.3 again
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • @@ -1679,7 +1000,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • [Connection] Verify stream is valid resource
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1698,8 +1019,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Bug fix: Check read buffer for data before shutdown signal and end emit (@artydev)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: Check read buffer for data before shutdown signal and end emit (@artydev)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: v0.3.4 changes merged for v0.4.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1718,7 +1039,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Reset socket to non-blocking after shutting down (PHP bug)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1737,7 +1058,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC break: Update to React/Promise 2.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • BC break: Update to Evenement 2.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • @@ -1765,7 +1086,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1784,7 +1105,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1803,8 +1124,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Support binding to IPv6 addresses (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: Support binding to IPv6 addresses (@clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1822,7 +1143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Bump React dependencies to v0.3
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1846,7 +1167,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1865,7 +1186,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1884,7 +1205,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bump React dependencies to v0.2
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1903,7 +1224,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1922,7 +1243,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1943,8 +1264,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              diff --git a/socket/index.html b/socket/index.html index 382d9a59b..7046ce4bc 100644 --- a/socket/index.html +++ b/socket/index.html @@ -5,7 +5,8 @@ - Socket - ReactPHP + Socket: +Socket - ReactPHP @@ -20,13 +21,13 @@ - - + + - - - + + + @@ -40,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                                              • +
                                                                                                                                                                                                                                                                                                                                                                                                                                              • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                                              • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                                                PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                                              - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • SocketServer
                                                                                                                                                                                                                                                                                                                                                                                                                                            • +
                                                                                                                                                                                                                                                                                                                                                                                                                                            • Server
                                                                                                                                                                                                                                                                                                                                                                                                                                            • Advanced server usage
                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -293,7 +275,6 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced client usage -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Quickstart example

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Quickstart example

                                                                                                                                                                                                                                                                                                                                                                                                                                                Here is a server that closes the connection if you send it anything:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('127.0.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$socket->on('connection', function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write("Hello " . $connection->getRemoteAddress() . "!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write("Welcome to this amazing server!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write("Here's a tip: don't say anything.\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->on('data', function ($data) use ($connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        $connection->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$socket = new React\Socket\Server('127.0.0.1:8080', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$socket->on('connection', function (ConnectionInterface $conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $conn->write("Hello " . $conn->getRemoteAddress() . "!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $conn->write("Welcome to this amazing server!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $conn->write("Here's a tip: don't say anything.\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $conn->on('data', function ($data) use ($conn) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        $conn->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    });
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Here's a client that outputs the output of said server and then attempts to send it a string:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connector = new React\Socket\Connector();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connector->connect('127.0.0.1:8080')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->pipe(new React\Stream\WritableResourceStream(STDOUT));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write("Hello World!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Connection usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                ConnectionInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$connector = new React\Socket\Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$connector->connect('127.0.0.1:8080')->then(function (ConnectionInterface $conn) use ($loop) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $conn->pipe(new React\Stream\WritableResourceStream(STDOUT, $loop));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $conn->write("Hello World!\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Connection usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +ConnectionInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                The ConnectionInterface is used to represent any incoming and outgoing connection, such as a normal TCP/IP connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                An incoming or outgoing connection is a duplex stream (both readable and @@ -346,33 +334,34 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                Because the ConnectionInterface implements the underlying DuplexStreamInterface you can use any of its events and methods as usual:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connection->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'ended';
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'error: ' . $e->getMessage();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'closed';
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->write($data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->end($data = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$connection->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -// …
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $connection->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$connection->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'ended';
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$connection->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'error: ' . $e->getMessage();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$connection->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'closed';
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$connection->write($data);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$connection->end($data = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$connection->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +//

                                                                                                                                                                                                                                                                                                                                                                                                                                                For more details, see the DuplexStreamInterface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                getRemoteAddress()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +getRemoteAddress()

                                                                                                                                                                                                                                                                                                                                                                                                                                                The getRemoteAddress(): ?string method returns the full remote address (URI) where this connection has been established with.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $connection->getRemoteAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -echo 'Connection with ' . $address . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $connection->getRemoteAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +echo 'Connection with ' . $address . PHP_EOL;

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the remote address can not be determined or is unknown at this time (such as after the connection has been closed), it MAY return a NULL value instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Otherwise, it will return the full address (URI) as a string value, such @@ -382,14 +371,15 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                on the underlying transport protocol.

                                                                                                                                                                                                                                                                                                                                                                                                                                                If this is a TCP/IP based connection and you only want the remote IP, you may use something like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $connection->getRemoteAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$ip = trim(parse_url($address, PHP_URL_HOST), '[]');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -echo 'Connection with ' . $ip . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                getLocalAddress()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $connection->getRemoteAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$ip = trim(parse_url($address, PHP_URL_HOST), '[]');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +echo 'Connection with ' . $ip . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +getLocalAddress()

                                                                                                                                                                                                                                                                                                                                                                                                                                                The getLocalAddress(): ?string method returns the full local address (URI) where this connection has been established with.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $connection->getLocalAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -echo 'Connection with ' . $address . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $connection->getLocalAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +echo 'Connection with ' . $address . PHP_EOL;

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the local address can not be determined or is unknown at this time (such as after the connection has been closed), it MAY return a NULL value instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Otherwise, it will return the full address (URI) as a string value, such @@ -405,8 +395,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                If your system has multiple interfaces (e.g. a WAN and a LAN interface), you can use this method to find out which interface was actually used for this connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Server usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                ServerInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Server usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +ServerInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                                The ServerInterface is responsible for providing an interface for accepting incoming streaming connections, such as a normal TCP/IP connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Most higher-level components (such as a HTTP server) accept an instance @@ -418,27 +410,30 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                Besides defining a few methods, this interface also implements the EventEmitterInterface which allows you to react to certain events.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                connection event

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +connection event

                                                                                                                                                                                                                                                                                                                                                                                                                                                The connection event will be emitted whenever a new connection has been established, i.e. a new client connects to this server socket:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket->on('connection', function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'new connection' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'new connection' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the ConnectionInterface for more details about handling the incoming connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                error event

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +error event

                                                                                                                                                                                                                                                                                                                                                                                                                                                The error event will be emitted whenever there's an error accepting a new connection from a client.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that this is not a fatal error event, i.e. the server keeps listening for new connections even after this event.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                getAddress()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +getAddress()

                                                                                                                                                                                                                                                                                                                                                                                                                                                The getAddress(): ?string method can be used to return the full address (URI) this server is currently listening on.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $socket->getAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -echo 'Server listening on ' . $address . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $server->getAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +echo 'Server listening on ' . $address . PHP_EOL;

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the address can not be determined or is unknown at this time (such as after the socket has been closed), it MAY return a NULL value instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Otherwise, it will return the full address (URI) as a string value, such @@ -448,10 +443,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                on the underlying transport protocol.

                                                                                                                                                                                                                                                                                                                                                                                                                                                If this is a TCP/IP based server and you only want the local port, you may use something like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $socket->getAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$port = parse_url($address, PHP_URL_PORT);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -echo 'Server listening on port ' . $port . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                pause()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $address = $server->getAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$port = parse_url($address, PHP_URL_PORT);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +echo 'Server listening on port ' . $port . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +pause()

                                                                                                                                                                                                                                                                                                                                                                                                                                                The pause(): void method can be used to pause accepting new incoming connections.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Removes the socket resource from the EventLoop and thus stop accepting @@ -464,9 +460,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                to accept new connections.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Once the server is paused, no futher connection events SHOULD be emitted.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$socket->on('connection', assertShouldNeverCalled());
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server->on('connection', assertShouldNeverCalled());

                                                                                                                                                                                                                                                                                                                                                                                                                                                This method is advisory-only, though generally not recommended, the server MAY continue emitting connection events.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Unless otherwise noted, a successfully opened server SHOULD NOT start @@ -475,96 +471,96 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that both methods can be called any number of times, in particular calling pause() more than once SHOULD NOT have any effect. Similarly, calling this after close() is a NO-OP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                resume()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +resume()

                                                                                                                                                                                                                                                                                                                                                                                                                                                The resume(): void method can be used to resume accepting new incoming connections.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Re-attach the socket resource to the EventLoop after a previous pause().

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -Loop::addTimer(1.0, function () use ($socket) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $socket->resume();
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$loop->addTimer(1.0, function () use ($server) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $server->resume();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that both methods can be called any number of times, in particular calling resume() without a prior pause() SHOULD NOT have any effect. Similarly, calling this after close() is a NO-OP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                close()

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +close()

                                                                                                                                                                                                                                                                                                                                                                                                                                                The close(): void method can be used to shut down this listening socket.

                                                                                                                                                                                                                                                                                                                                                                                                                                                This will stop listening for new incoming connections on this socket.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                echo 'Shutting down server socket' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$socket->close();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                echo 'Shutting down server socket' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server->close();

                                                                                                                                                                                                                                                                                                                                                                                                                                                Calling this method more than once on the same instance is a NO-OP.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                SocketServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The SocketServer class is the main class in this package that implements the +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Server

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                The Server class is the main class in this package that implements the ServerInterface and allows you to accept incoming -streaming connections, such as plaintext TCP/IP or secure TLS connection streams.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to accept plaintext TCP/IP connections, you can simply pass a host -and port combination like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('127.0.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Listening on the localhost address 127.0.0.1 means it will not be reachable from -outside of this system. -In order to change the host the socket is listening on, you can provide an IP -address of an interface or use the special 0.0.0.0 address to listen on all -interfaces:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('0.0.0.0:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +streaming connections, such as plaintext TCP/IP or secure TLS connection streams. +Connections can also be accepted on Unix domain sockets.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server(8080, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                As above, the $uri parameter can consist of only a port, in which case the +server will default to listening on the localhost address 127.0.0.1, +which means it will not be reachable from outside of this system.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to use a random port assignment, you can use the port 0:

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server(0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$address = $server->getAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to change the host the socket is listening on, you can provide an IP +address through the first parameter provided to the constructor, optionally +preceded by the tcp:// scheme:

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server('192.168.0.1:8080', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to listen on an IPv6 address, you MUST enclose the host in square brackets:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('[::1]:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to use a random port assignment, you can use the port 0:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('127.0.0.1:0');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$address = $socket->getAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server('[::1]:8080', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                To listen on a Unix domain socket (UDS) path, you MUST prefix the URI with the unix:// scheme:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('unix:///tmp/server.sock');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to listen on an existing file descriptor (FD) number, you MUST prefix -the URI with php://fd/ like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('php://fd/3');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server('unix:///tmp/server.sock', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the given URI is invalid, does not contain a port, any other scheme or if it contains a hostname, it will throw an InvalidArgumentException:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                // throws InvalidArgumentException due to missing port
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$socket = new React\Socket\SocketServer('127.0.0.1');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                // throws InvalidArgumentException due to missing port
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server = new Server('127.0.0.1', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the given URI appears to be valid, but listening on it fails (such as if port is already in use or port below 1024 may require root access etc.), it will throw a RuntimeException:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $first = new React\Socket\SocketServer('127.0.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -// throws RuntimeException because port is already in use
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$second = new React\Socket\SocketServer('127.0.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $first = new Server(8080, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +// throws RuntimeException because port is already in use
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$second = new Server(8080, $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that these error conditions may vary depending on your system and/or configuration. See the exception message and code for more details about the actual error condition.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Optionally, you can specify TCP socket context options +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Optionally, you can specify TCP socket context options for the underlying stream socket resource like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('[::1]:8080', array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tcp' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'backlog' => 200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'so_reuseport' => true,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'ipv6_v6only' => true
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server('[::1]:8080', $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'tcp' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'backlog' => 200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'so_reuseport' => true,
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'ipv6_v6only' => true
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that available socket context options, +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that available socket context options, their defaults and effects of changing these may vary depending on your system and/or PHP version. Passing unknown context options has no effect. -The backlog context option defaults to 511 unless given explicitly.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +For BC reasons, you can also pass the TCP socket context options as a simple +array without wrapping this in another array under the tcp key.

                                                                                                                                                                                                                                                                                                                                                                                                                                                You can start a secure TLS (formerly known as SSL) server by simply prepending the tls:// URI scheme. Internally, it will wait for plaintext TCP/IP connections and then performs a TLS handshake for each connection. -It thus requires valid TLS context options, +It thus requires valid TLS context options, which in its most basic form may look something like this if you're using a PEM encoded certificate file:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('tls://127.0.0.1:8080', array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'local_cert' => 'server.pem'
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server('tls://127.0.0.1:8080', $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'local_cert' => 'server.pem'
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                +));

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the certificate file will not be loaded on instantiation but when an incoming connection initializes its TLS context. @@ -573,23 +569,23 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                If your private key is encrypted with a passphrase, you have to specify it like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('tls://127.0.0.1:8000', array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'local_cert' => 'server.pem',
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'passphrase' => 'secret'
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server('tls://127.0.0.1:8000', $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'local_cert' => 'server.pem',
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'passphrase' => 'secret'
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                +));

                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, this server supports TLSv1.0+ and excludes support for legacy SSLv2/SSLv3. As of PHP 5.6+ you can also explicitly choose the TLS version you want to negotiate with the remote side:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket = new React\Socket\SocketServer('tls://127.0.0.1:8000', array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'local_cert' => 'server.pem',
                                                                                                                                                                                                                                                                                                                                                                                                                                                -        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new Server('tls://127.0.0.1:8000', $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'local_cert' => 'server.pem',
                                                                                                                                                                                                                                                                                                                                                                                                                                                +        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    )
                                                                                                                                                                                                                                                                                                                                                                                                                                                +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that available TLS context options, +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that available TLS context options, their defaults and effects of changing these may vary depending on your system and/or PHP version. The outer context array allows you to also use tcp (and possibly more) @@ -600,103 +596,90 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                Whenever a client connects, it will emit a connection event with a connection instance implementing ConnectionInterface:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $socket->on('connection', function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Plaintext connection from ' . $connection->getRemoteAddress() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    …
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'Plaintext connection from ' . $connection->getRemoteAddress() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the ServerInterface for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the SocketServer class is a concrete implementation for TCP/IP sockets. +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the Server class is a concrete implementation for TCP/IP sockets. If you want to typehint in your higher-level protocol implementation, you SHOULD use the generic ServerInterface instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Changelog v1.9.0: This class has been added with an improved constructor signature -as a replacement for the previous Server class in order to avoid any ambiguities. -The previous name has been deprecated and should not be used anymore.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced server usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                TcpServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Advanced server usage

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +TcpServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                The TcpServer class implements the ServerInterface and is responsible for accepting plaintext TCP/IP connections.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new React\Socket\TcpServer(8080);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new TcpServer(8080, $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                As above, the $uri parameter can consist of only a port, in which case the server will default to listening on the localhost address 127.0.0.1, which means it will not be reachable from outside of this system.

                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to use a random port assignment, you can use the port 0:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new React\Socket\TcpServer(0);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$address = $server->getAddress();
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new TcpServer(0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$address = $server->getAddress();

                                                                                                                                                                                                                                                                                                                                                                                                                                                In order to change the host the socket is listening on, you can provide an IP address through the first parameter provided to the constructor, optionally preceded by the tcp:// scheme:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new React\Socket\TcpServer('192.168.0.1:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new TcpServer('192.168.0.1:8080', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                If you want to listen on an IPv6 address, you MUST enclose the host in square brackets:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new React\Socket\TcpServer('[::1]:8080');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new TcpServer('[::1]:8080', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the given URI is invalid, does not contain a port, any other scheme or if it contains a hostname, it will throw an InvalidArgumentException:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                // throws InvalidArgumentException due to missing port
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Socket\TcpServer('127.0.0.1');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                // throws InvalidArgumentException due to missing port
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server = new TcpServer('127.0.0.1', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the given URI appears to be valid, but listening on it fails (such as if port is already in use or port below 1024 may require root access etc.), it will throw a RuntimeException:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $first = new React\Socket\TcpServer(8080);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -// throws RuntimeException because port is already in use
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$second = new React\Socket\TcpServer(8080);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $first = new TcpServer(8080, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +// throws RuntimeException because port is already in use
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$second = new TcpServer(8080, $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that these error conditions may vary depending on your system and/or configuration. See the exception message and code for more details about the actual error condition.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Optionally, you can specify socket context options +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Optionally, you can specify socket context options for the underlying stream socket resource like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new React\Socket\TcpServer('[::1]:8080', null, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'backlog' => 200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'so_reuseport' => true,
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'ipv6_v6only' => true
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new TcpServer('[::1]:8080', $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'backlog' => 200,
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'so_reuseport' => true,
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'ipv6_v6only' => true
                                                                                                                                                                                                                                                                                                                                                                                                                                                +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that available socket context options, +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that available socket context options, their defaults and effects of changing these may vary depending on your system and/or PHP version. -Passing unknown context options has no effect. -The backlog context option defaults to 511 unless given explicitly.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +Passing unknown context options has no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Whenever a client connects, it will emit a connection event with a connection instance implementing ConnectionInterface:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('connection', function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Plaintext connection from ' . $connection->getRemoteAddress() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    …
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'Plaintext connection from ' . $connection->getRemoteAddress() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the ServerInterface for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                SecureServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +SecureServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                The SecureServer class implements the ServerInterface and is responsible for providing a secure TLS (formerly known as SSL) server.

                                                                                                                                                                                                                                                                                                                                                                                                                                                It does so by wrapping a TcpServer instance which waits for plaintext TCP/IP connections and then performs a TLS handshake for each connection. -It thus requires valid TLS context options, +It thus requires valid TLS context options, which in its most basic form may look something like this if you're using a PEM encoded certificate file:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new React\Socket\TcpServer(8000);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Socket\SecureServer($server, null, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'local_cert' => 'server.pem'
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new TcpServer(8000, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server = new SecureServer($server, $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'local_cert' => 'server.pem'
                                                                                                                                                                                                                                                                                                                                                                                                                                                +));

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the certificate file will not be loaded on instantiation but when an incoming connection initializes its TLS context. @@ -705,47 +688,42 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                If your private key is encrypted with a passphrase, you have to specify it like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new React\Socket\TcpServer(8000);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Socket\SecureServer($server, null, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'local_cert' => 'server.pem',
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'passphrase' => 'secret'
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new TcpServer(8000, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server = new SecureServer($server, $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'local_cert' => 'server.pem',
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'passphrase' => 'secret'
                                                                                                                                                                                                                                                                                                                                                                                                                                                +));

                                                                                                                                                                                                                                                                                                                                                                                                                                                By default, this server supports TLSv1.0+ and excludes support for legacy SSLv2/SSLv3. As of PHP 5.6+ you can also explicitly choose the TLS version you want to negotiate with the remote side:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new React\Socket\TcpServer(8000);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$server = new React\Socket\SecureServer($server, null, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'local_cert' => 'server.pem',
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER
                                                                                                                                                                                                                                                                                                                                                                                                                                                -));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new TcpServer(8000, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$server = new SecureServer($server, $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'local_cert' => 'server.pem',
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER
                                                                                                                                                                                                                                                                                                                                                                                                                                                +));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that available TLS context options, +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that available TLS context options, their defaults and effects of changing these may vary depending on your system and/or PHP version. Passing unknown context options has no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Whenever a client completes the TLS handshake, it will emit a connection event with a connection instance implementing ConnectionInterface:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('connection', function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Secure connection from' . $connection->getRemoteAddress() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    …
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'Secure connection from' . $connection->getRemoteAddress() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                Whenever a client fails to perform a successful TLS handshake, it will emit an error event and then close the underlying TCP/IP connection:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'Error' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'Error' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the ServerInterface for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that the SecureServer class is a concrete implementation for TLS sockets. If you want to typehint in your higher-level protocol implementation, you SHOULD use the generic ServerInterface instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Advanced usage: Despite allowing any ServerInterface as first parameter, you SHOULD pass a TcpServer instance as first parameter, unless you @@ -761,43 +739,31 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                                meet this requirement, the SecureServer will emit an error event and then close the underlying connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                UnixServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +UnixServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                The UnixServer class implements the ServerInterface and is responsible for accepting connections on Unix domain sockets (UDS).

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new React\Socket\UnixServer('/tmp/server.sock');
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server = new UnixServer('/tmp/server.sock', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                As above, the $uri parameter can consist of only a socket path or socket path prefixed by the unix:// scheme.

                                                                                                                                                                                                                                                                                                                                                                                                                                                If the given URI appears to be valid, but listening on it fails (such as if the socket is already in use or the file not accessible etc.), it will throw a RuntimeException:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $first = new React\Socket\UnixServer('/tmp/same.sock');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -// throws RuntimeException because socket is already in use
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$second = new React\Socket\UnixServer('/tmp/same.sock');
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Note that these error conditions may vary depending on your system and/or -configuration. -In particular, Zend PHP does only report "Unknown error" when the UDS path -already exists and can not be bound. You may want to check is_file() on the -given UDS path to report a more user-friendly error message in this case. -See the exception message and code for more details about the actual error -condition.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $first = new UnixServer('/tmp/same.sock', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +// throws RuntimeException because socket is already in use
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$second = new UnixServer('/tmp/same.sock', $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                                                Whenever a client connects, it will emit a connection event with a connection instance implementing ConnectionInterface:

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('connection', function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    echo 'New connection' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    …
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    echo 'New connection' . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});

                                                                                                                                                                                                                                                                                                                                                                                                                                                See also the ServerInterface for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                LimitingServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                +LimitingServer

                                                                                                                                                                                                                                                                                                                                                                                                                                                The LimitingServer decorator wraps a given ServerInterface and is responsible for limiting and keeping track of open connections to this server instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Whenever the underlying server emits a connection event, it will check its @@ -810,21 +776,21 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              Whenever a connection closes, it will remove this connection from the list of open connections.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new React\Socket\LimitingServer($server, 100);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$server->on('connection', function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    …
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the second example for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new LimitingServer($server, 100);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the second example for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                              You have to pass a maximum number of open connections to ensure the server will automatically reject (close) connections once this limit is exceeded. In this case, it will emit an error event to inform about this and no connection event will be emitted.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new React\Socket\LimitingServer($server, 100);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$server->on('connection', function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    …
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new LimitingServer($server, 100);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                              You MAY pass a null limit in order to put no limit on the number of open connections and keep accepting new connection until you run out of operating system resources (such as open file handles). This may be @@ -844,19 +810,22 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              a response message (such as HTTP), but may be less useful for other protocols that demand immediate responses (such as a "welcome" message in an interactive chat).

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new React\Socket\LimitingServer($server, 100, true);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$server->on('connection', function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    …
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              getConnections()
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $server = new LimitingServer($server, 100, true);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$server->on('connection', function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('hello there!' . PHP_EOL);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +getConnections()

                                                                                                                                                                                                                                                                                                                                                                                                                                              The getConnections(): ConnectionInterface[] method can be used to return an array with all currently active connections.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              foreach ($server->getConnection() as $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('Hi!');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -}
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Client usage

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              ConnectorInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              foreach ($server->getConnection() as $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('Hi!');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +}
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +Client usage

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +ConnectorInterface

                                                                                                                                                                                                                                                                                                                                                                                                                                              The ConnectorInterface is responsible for providing an interface for establishing streaming connections, such as a normal TCP/IP connection.

                                                                                                                                                                                                                                                                                                                                                                                                                                              This is the main interface defined in this package and it is used throughout @@ -867,48 +836,51 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              This is usually done via dependency injection, so it's fairly simple to actually swap this implementation against any other implementation of this interface.

                                                                                                                                                                                                                                                                                                                                                                                                                                              The interface only offers a single method:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              connect()

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              The connect(string $uri): PromiseInterface<ConnectionInterface> method can be used to -create a streaming connection to the given remote address.

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +connect()

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              The connect(string $uri): PromiseInterface<ConnectionInterface, Exception> method +can be used to create a streaming connection to the given remote address.

                                                                                                                                                                                                                                                                                                                                                                                                                                              It returns a Promise which either fulfills with a stream implementing ConnectionInterface on success or rejects with an Exception if the connection is not successful:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector->connect('google.com:443')->then(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -        // connection successfully established
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    },
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    function (Exception $error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -        // failed to connect due to $error
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    }
                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector->connect('google.com:443')->then(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +        // connection successfully established
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    },
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    function (Exception $error) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +        // failed to connect due to $error
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    }
                                                                                                                                                                                                                                                                                                                                                                                                                                              +);

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also ConnectionInterface for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                                              The returned Promise MUST be implemented in such a way that it can be cancelled when it is still pending. Cancelling a pending promise MUST reject its value with an Exception. It SHOULD clean up any underlying resources and references as applicable:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $connector->connect($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Connector

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $connector->connect($uri);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +Connector

                                                                                                                                                                                                                                                                                                                                                                                                                                              The Connector class is the main class in this package that implements the ConnectorInterface and allows you to create streaming connections.

                                                                                                                                                                                                                                                                                                                                                                                                                                              You can use this connector to create any kind of streaming connections, such as plaintext TCP/IP, secure TLS or local Unix connection streams.

                                                                                                                                                                                                                                                                                                                                                                                                                                              It binds to the main event loop and can be used like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new React\Socket\Connector();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector->connect($uri)->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -}, function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $loop = React\EventLoop\Factory::create();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector = new Connector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector->connect($uri)->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop->run();

                                                                                                                                                                                                                                                                                                                                                                                                                                              In order to create a plaintext TCP/IP connection, you can simply pass a host and port combination like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector->connect('www.google.com:80')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector->connect('www.google.com:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                              If you do no specify a URI scheme in the destination URI, it will assume tcp:// as a default and establish a plaintext TCP/IP connection. @@ -917,16 +889,16 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              In order to create a secure TLS connection, you can use the tls:// URI scheme like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector->connect('tls://www.google.com:443')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector->connect('tls://www.google.com:443')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                              In order to create a local Unix domain socket connection, you can use the unix:// URI scheme like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector->connect('unix:///tmp/demo.sock')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector->connect('unix:///tmp/demo.sock')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                              The getRemoteAddress() method will return the target Unix domain socket (UDS) path as given to the connect() method, including @@ -939,138 +911,126 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              also shares all of their features and implementation details. If you want to typehint in your higher-level protocol implementation, you SHOULD use the generic ConnectorInterface instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              As of v1.4.0, the Connector class defaults to using the -happy eyeballs algorithm to -automatically connect over IPv4 or IPv6 when a hostname is given. -This automatically attempts to connect using both IPv4 and IPv6 at the same time -(preferring IPv6), thus avoiding the usual problems faced by users with imperfect -IPv6 connections or setups. -If you want to revert to the old behavior of only doing an IPv4 lookup and -only attempt a single IPv4 connection, you can set up the Connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'happy_eyeballs' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Similarly, you can also affect the default DNS behavior as follows. -The Connector class will try to detect your system DNS settings (and uses +

                                                                                                                                                                                                                                                                                                                                                                                                                                              The Connector class will try to detect your system DNS settings (and uses Google's public DNS server 8.8.8.8 as a fallback if unable to determine your system settings) to resolve all public hostnames into underlying IP addresses by default. If you explicitly want to use a custom DNS server (such as a local DNS relay or a company wide DNS server), you can set up the Connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'dns' => '127.0.1.1'
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector->connect('localhost:80')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'dns' => '127.0.1.1'
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector->connect('localhost:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                              If you do not want to use a DNS resolver at all and want to connect to IP addresses only, you can also set up your Connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'dns' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector->connect('127.0.0.1:80')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced: If you need a custom DNS React\Dns\Resolver\ResolverInterface instance, you -can also set up your Connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$resolver = $dnsResolverFactory->createCached('127.0.1.1');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'dns' => $resolver
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector->connect('localhost:80')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'dns' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector->connect('127.0.0.1:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced: If you need a custom DNS Resolver instance, you can also set up +your Connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$resolver = $dnsResolverFactory->createCached('127.0.1.1', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'dns' => $resolver
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector->connect('localhost:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                              By default, the tcp:// and tls:// URI schemes will use timeout value that -respects your default_socket_timeout ini setting (which defaults to 60s). +repects your default_socket_timeout ini setting (which defaults to 60s). If you want a custom timeout value, you can simply pass this like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'timeout' => 10.0
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'timeout' => 10.0
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));

                                                                                                                                                                                                                                                                                                                                                                                                                                              Similarly, if you do not want to apply a timeout at all and let the operating system handle this, you can pass a boolean flag like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'timeout' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'timeout' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));

                                                                                                                                                                                                                                                                                                                                                                                                                                              By default, the Connector supports the tcp://, tls:// and unix:// URI schemes. If you want to explicitly prohibit any of these, you can simply pass boolean flags like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              // only allow secure TLS connections
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'tcp' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'tls' => true,
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'unix' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector->connect('tls://google.com:443')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              // only allow secure TLS connections
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'tcp' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'tls' => true,
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'unix' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector->connect('tls://google.com:443')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                              The tcp:// and tls:// also accept additional context options passed to the underlying connectors. If you want to explicitly pass additional context options, you can simply pass arrays of context options like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              // allow insecure TLS connections
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'tcp' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -        'bindto' => '192.168.0.1:0'
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    ),
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -        'verify_peer' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              -        'verify_peer_name' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    ),
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector->connect('tls://localhost:443')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              // allow insecure TLS connections
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'tcp' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +        'bindto' => '192.168.0.1:0'
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    ),
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +        'verify_peer' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              +        'verify_peer_name' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    ),
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector->connect('tls://localhost:443')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                              By default, this connector supports TLSv1.0+ and excludes support for legacy SSLv2/SSLv3. As of PHP 5.6+ you can also explicitly choose the TLS version you want to negotiate with the remote side:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    )
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'tls' => array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    )
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));

                                                                                                                                                                                                                                                                                                                                                                                                                                              For more details about context options, please refer to the PHP documentation -about socket context options -and SSL context options.

                                                                                                                                                                                                                                                                                                                                                                                                                                              +about socket context options +and SSL context options.

                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced: By default, the Connector supports the tcp://, tls:// and unix:// URI schemes. For this, it sets up the required connector classes automatically. If you want to explicitly pass custom connectors for any of these, you can simply pass an instance implementing the ConnectorInterface like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$resolver = $dnsResolverFactory->createCached('127.0.1.1');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$tcp = new React\Socket\HappyEyeBallsConnector(null, new React\Socket\TcpConnector(), $resolver);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$tls = new React\Socket\SecureConnector($tcp);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$unix = new React\Socket\UnixConnector();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector = new React\Socket\Connector(array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'tcp' => $tcp,
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'tls' => $tls,
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'unix' => $unix,
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'dns' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'timeout' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector->connect('google.com:80')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$resolver = $dnsResolverFactory->createCached('127.0.1.1', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$tcp = new DnsConnector(new TcpConnector($loop), $resolver);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$tls = new SecureConnector($tcp, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$unix = new UnixConnector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector = new Connector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'tcp' => $tcp,
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'tls' => $tls,
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'unix' => $unix,
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'dns' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'timeout' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector->connect('google.com:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});

                                                                                                                                                                                                                                                                                                                                                                                                                                              Internally, the tcp:// connector will always be wrapped by the DNS resolver, unless you disable DNS like in the above example. In this case, the tcp:// @@ -1084,51 +1044,35 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              Internally, the tcp:// and tls:// connectors will always be wrapped by TimeoutConnector, unless you disable timeouts like in the above example.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Changelog v1.9.0: The constructur signature has been updated to take the -optional $context as the first parameter and the optional $loop as a second -argument. The previous signature has been deprecated and should not be used anymore.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              // constructor signature as of v1.9.0
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector = new React\Socket\Connector(array $context = [], ?LoopInterface $loop = null);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -// legacy constructor signature before v1.9.0
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector = new React\Socket\Connector(?LoopInterface $loop = null, array $context = []);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced client usage

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              TcpConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              The TcpConnector class implements the +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +Advanced client usage

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +TcpConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              The React\Socket\TcpConnector class implements the ConnectorInterface and allows you to create plaintext TCP/IP connections to any IP-port-combination:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $tcpConnector = new React\Socket\TcpConnector();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$tcpConnector->connect('127.0.0.1:80')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $tcpConnector = new React\Socket\TcpConnector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$tcpConnector->connect('127.0.0.1:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                              Pending connection attempts can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $tcpConnector->connect('127.0.0.1:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $tcpConnector->connect('127.0.0.1:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$promise->cancel();

                                                                                                                                                                                                                                                                                                                                                                                                                                              Calling cancel() on a pending promise will close the underlying socket resource, thus cancelling the pending TCP/IP connection, and reject the resulting promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                              You can optionally pass additional -socket context options +socket context options to the constructor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $tcpConnector = new React\Socket\TcpConnector(null, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'bindto' => '192.168.0.1:0'
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $tcpConnector = new React\Socket\TcpConnector($loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'bindto' => '192.168.0.1:0'
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));

                                                                                                                                                                                                                                                                                                                                                                                                                                              Note that this class only allows you to connect to IP-port-combinations. If the given URI is invalid, does not contain a valid IP address and port or contains any other scheme, it will reject with an @@ -1145,51 +1089,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              This is used by the SecureConnector and DnsConnector to verify the peer name and can also be used if you want a custom TLS peer name.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              HappyEyeBallsConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              The HappyEyeBallsConnector class implements the -ConnectorInterface and allows you to create plaintext -TCP/IP connections to any hostname-port-combination. Internally it implements the -happy eyeballs algorithm from RFC6555 and -RFC8305 to support IPv6 and IPv4 hostnames.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              It does so by decorating a given TcpConnector instance so that it first -looks up the given domain name via DNS (if applicable) and then establishes the -underlying TCP/IP connection to the resolved target IP address.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Make sure to set up your DNS resolver and underlying TCP connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dns = $dnsResolverFactory->createCached('8.8.8.8');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dnsConnector = new React\Socket\HappyEyeBallsConnector(null, $tcpConnector, $dns);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dnsConnector->connect('www.google.com:80')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Pending connection attempts can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $dnsConnector->connect('www.google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Calling cancel() on a pending promise will cancel the underlying DNS lookups -and/or the underlying TCP/IP connection(s) and reject the resulting promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced usage: Internally, the HappyEyeBallsConnector relies on a Resolver to -look up the IP addresses for the given hostname. -It will then replace the hostname in the destination URI with this IP's and -append a hostname query parameter and pass this updated URI to the underlying -connector. -The Happy Eye Balls algorithm describes looking the IPv6 and IPv4 address for -the given hostname so this connector sends out two DNS lookups for the A and -AAAA records. It then uses all IP addresses (both v6 and v4) and tries to -connect to all of them with a 50ms interval in between. Alterating between IPv6 -and IPv4 addresses. When a connection is established all the other DNS lookups -and connection attempts are cancelled.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              DnsConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +DnsConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              The DnsConnector class implements the ConnectorInterface and allows you to create plaintext TCP/IP connections to any hostname-port-combination.

                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1197,25 +1098,27 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              looks up the given domain name via DNS (if applicable) and then establishes the underlying TCP/IP connection to the resolved target IP address.

                                                                                                                                                                                                                                                                                                                                                                                                                                              Make sure to set up your DNS resolver and underlying TCP connector like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dns = $dnsResolverFactory->createCached('8.8.8.8');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dnsConnector = new React\Socket\DnsConnector($tcpConnector, $dns);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$dnsConnector->connect('www.google.com:80')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $dnsResolverFactory = new React\Dns\Resolver\Factory();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$dns = $dnsResolverFactory->createCached('8.8.8.8', $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$dnsConnector = new React\Socket\DnsConnector($tcpConnector, $dns);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$dnsConnector->connect('www.google.com:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write('...');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->end();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                              Pending connection attempts can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $dnsConnector->connect('www.google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $dnsConnector->connect('www.google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$promise->cancel();

                                                                                                                                                                                                                                                                                                                                                                                                                                              Calling cancel() on a pending promise will cancel the underlying DNS lookup and/or the underlying TCP/IP connection and reject the resulting promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced usage: Internally, the DnsConnector relies on a React\Dns\Resolver\ResolverInterface -to look up the IP address for the given hostname. +

                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced usage: Internally, the DnsConnector relies on a Resolver to +look up the IP address for the given hostname. It will then replace the hostname in the destination URI with this IP and append a hostname query parameter and pass this updated URI to the underlying connector. @@ -1225,44 +1128,42 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              If a hostname is given explicitly, this query parameter will not be modified, which can be useful if you want a custom TLS peer name.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              SecureConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +SecureConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              The SecureConnector class implements the ConnectorInterface and allows you to create secure TLS (formerly known as SSL) connections to any hostname-port-combination.

                                                                                                                                                                                                                                                                                                                                                                                                                                              It does so by decorating a given DnsConnector instance so that it first creates a plaintext TCP/IP connection and then enables TLS encryption on this stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $secureConnector = new React\Socket\SecureConnector($dnsConnector);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$secureConnector->connect('www.google.com:443')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write("GET / HTTP/1.0\r\nHost: www.google.com\r\n\r\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    ...
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $secureConnector = new React\Socket\SecureConnector($dnsConnector, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$secureConnector->connect('www.google.com:443')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write("GET / HTTP/1.0\r\nHost: www.google.com\r\n\r\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    ...
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop->run();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                              Pending connection attempts can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $secureConnector->connect('www.google.com:443');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $secureConnector->connect('www.google.com:443');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$promise->cancel();

                                                                                                                                                                                                                                                                                                                                                                                                                                              Calling cancel() on a pending promise will cancel the underlying TCP/IP connection and/or the SSL/TLS negotiation and reject the resulting promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                              You can optionally pass additional -SSL context options +SSL context options to the constructor like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $secureConnector = new React\Socket\SecureConnector($dnsConnector, null, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'verify_peer' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'verify_peer_name' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $secureConnector = new React\Socket\SecureConnector($dnsConnector, $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'verify_peer' => false,
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'verify_peer_name' => false
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));

                                                                                                                                                                                                                                                                                                                                                                                                                                              By default, this connector supports TLSv1.0+ and excludes support for legacy SSLv2/SSLv3. As of PHP 5.6+ you can also explicitly choose the TLS version you want to negotiate with the remote side:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $secureConnector = new React\Socket\SecureConnector($dnsConnector, null, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
                                                                                                                                                                                                                                                                                                                                                                                                                                              -));
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $secureConnector = new React\Socket\SecureConnector($dnsConnector, $loop, array(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
                                                                                                                                                                                                                                                                                                                                                                                                                                              +));

                                                                                                                                                                                                                                                                                                                                                                                                                                              Advanced usage: Internally, the SecureConnector relies on setting up the required context options on the underlying stream resource. @@ -1273,39 +1174,38 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              trace race conditions, because all stream resources will use a single, shared default context resource otherwise.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              TimeoutConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +TimeoutConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              The TimeoutConnector class implements the ConnectorInterface and allows you to add timeout handling to any existing connector instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                              It does so by decorating any given ConnectorInterface instance and starting a timer that will automatically reject and abort any underlying connection attempt if it takes too long.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $timeoutConnector = new React\Socket\TimeoutConnector($connector, 3.0);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$timeoutConnector->connect('google.com:80')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    // connection succeeded within 3.0 seconds
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also any of the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $timeoutConnector = new React\Socket\TimeoutConnector($connector, 3.0, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$timeoutConnector->connect('google.com:80')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    // connection succeeded within 3.0 seconds
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also any of the examples.

                                                                                                                                                                                                                                                                                                                                                                                                                                              Pending connection attempts can be cancelled by cancelling its pending promise like so:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $timeoutConnector->connect('google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$promise->cancel();
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $promise = $timeoutConnector->connect('google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$promise->cancel();

                                                                                                                                                                                                                                                                                                                                                                                                                                              Calling cancel() on a pending promise will cancel the underlying connection attempt, abort the timer and reject the resulting promise.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              UnixConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +UnixConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              The UnixConnector class implements the ConnectorInterface and allows you to connect to Unix domain socket (UDS) paths like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new React\Socket\UnixConnector();
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$connector->connect('/tmp/demo.sock')->then(function (React\Socket\ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    $connection->write("HELLO\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                              -});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new React\Socket\UnixConnector($loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$connector->connect('/tmp/demo.sock')->then(function (ConnectionInterface $connection) {
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    $connection->write("HELLO\n");
                                                                                                                                                                                                                                                                                                                                                                                                                                              +});
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$loop->run();

                                                                                                                                                                                                                                                                                                                                                                                                                                              Connecting to Unix domain sockets is an atomic operation, i.e. its promise will settle (either resolve or reject) immediately. As such, calling cancel() on the resulting promise has no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1316,51 +1216,52 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              The getLocalAddress() method will most likely return a null value as this value is not applicable to UDS connections here.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              FixedUriConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +FixedUriConnector

                                                                                                                                                                                                                                                                                                                                                                                                                                              The FixedUriConnector class implements the ConnectorInterface and decorates an existing Connector to always use a fixed, preconfigured URI.

                                                                                                                                                                                                                                                                                                                                                                                                                                              This can be useful for consumers that do not support certain URIs, such as when you want to explicitly connect to a Unix domain socket (UDS) path instead of connecting to a default address assumed by an higher-level API:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new React\Socket\FixedUriConnector(
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    'unix:///var/run/docker.sock',
                                                                                                                                                                                                                                                                                                                                                                                                                                              -    new React\Socket\UnixConnector()
                                                                                                                                                                                                                                                                                                                                                                                                                                              -);
                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              -// destination will be ignored, actually connects to Unix domain socket
                                                                                                                                                                                                                                                                                                                                                                                                                                              -$promise = $connector->connect('localhost:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Install

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              The recommended way to install this library is through Composer. +

                                                                                                                                                                                                                                                                                                                                                                                                                                              $connector = new FixedUriConnector(
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    'unix:///var/run/docker.sock',
                                                                                                                                                                                                                                                                                                                                                                                                                                              +    new UnixConnector($loop)
                                                                                                                                                                                                                                                                                                                                                                                                                                              +);
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              +// destination will be ignored, actually connects to Unix domain socket
                                                                                                                                                                                                                                                                                                                                                                                                                                              +$promise = $connector->connect('localhost:80');
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +Install

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                                              This project follows SemVer. This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              composer require react/socket:^1.17
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $ composer require react/socket:^1.0

                                                                                                                                                                                                                                                                                                                                                                                                                                              See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                                              This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.3 through current PHP 8+ and HHVM. -It's highly recommended to use the latest supported PHP version for this project, -partly due to its vast performance improvements and partly because legacy PHP -versions require several workarounds as described below.

                                                                                                                                                                                                                                                                                                                                                                                                                                              +extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. +It's highly recommended to use PHP 7+ for this project, partly due to its vast +performance improvements and partly because legacy PHP versions require several +workarounds as described below.

                                                                                                                                                                                                                                                                                                                                                                                                                                              Secure TLS connections received some major upgrades starting with PHP 5.6, with the defaults now being more secure, while older versions required explicit context options. This library does not take responsibility over these context options, so it's up to consumers of this library to take care of setting appropriate context options as described above.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              PHP < 7.3.3 (and PHP < 7.2.15) suffers from a bug where feof() might -block with 100% CPU usage on fragmented TLS records. -We try to work around this by always consuming the complete receive -buffer at once to avoid stale data in TLS buffers. This is known to -work around high CPU usage for well-behaving peers, but this may -cause very large data chunks for high throughput scenarios. The buggy -behavior can still be triggered due to network I/O buffers or -malicious peers on affected versions, upgrading is highly recommended.

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              All versions of PHP prior to 5.6.8 suffered from a buffering issue where reading +from a streaming TLS connection could be one data event behind. +This library implements a work-around to try to flush the complete incoming +data buffers on these legacy PHP versions, which has a penalty of around 10% of +throughput on all connections. +With this work-around, we have not been able to reproduce this issue anymore, +but we have seen reports of people saying this could still affect some of the +older PHP versions (5.5.23, 5.6.7, and 5.6.8). +Note that this only affects some higher-level streaming protocols, such as +IRC over TLS, but should not affect HTTP over TLS (HTTPS). +Further investigation of this issue is needed. +For more insights, this issue is also covered by our test suite.

                                                                                                                                                                                                                                                                                                                                                                                                                                              PHP < 7.1.4 (and PHP < 7.0.18) suffers from a bug when writing big chunks of data over TLS streams at once. We try to work around this by limiting the write chunk size to 8192 @@ -1374,17 +1275,19 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Socket

                                                                                                                                                                                                                                                                                                                                                                                                                                              return a rejected promise instead. This issue is also covered by our test suite, which will skip related tests on affected versions.

                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +Tests

                                                                                                                                                                                                                                                                                                                                                                                                                                              To run the test suite, you first need to clone this repo and then install all -dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              composer install
                                                                                                                                                                                                                                                                                                                                                                                                                                              +dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $ composer install

                                                                                                                                                                                                                                                                                                                                                                                                                                              To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $ php vendor/bin/phpunit

                                                                                                                                                                                                                                                                                                                                                                                                                                              The test suite also contains a number of functional integration tests that rely on a stable internet connection. If you do not want to run these, they can simply be skipped like this:

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              vendor/bin/phpunit --exclude-group internet
                                                                                                                                                                                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                                                                                                                                                                                              License

                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              $ php vendor/bin/phpunit --exclude-group internet
                                                                                                                                                                                                                                                                                                                                                                                                                                              +

                                                                                                                                                                                                                                                                                                                                                                                                                                              +License

                                                                                                                                                                                                                                                                                                                                                                                                                                              MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.16.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.15.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.14.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.13.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.12.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.11.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.10.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.9.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.8.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.7.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.6.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.5.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.4.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.3.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.2.1 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.2.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.1.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • - - v1.0.0 - -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -
                                                                                                                                                                                                                                                                                                                                                                                                                                            • v0.8.12 @@ -1704,134 +1517,114 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Installation

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                              composer require react/socket:^1.17.0
                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                              composer require react/socket:^1.0.0

                                                                                                                                                                                                                                                                                                                                                                                                                                              Contributors

                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1848,7 +1641,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              Activity

                                                                                                                                                                                                                                                                                                                                                                                                                                              Activity

                                                                                                                                                                                                                                                                                                                                                                                                                          diff --git a/socket/license.html b/socket/license.html index 965f840fb..ef0e03226 100644 --- a/socket/license.html +++ b/socket/license.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -40,7 +40,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                        + +
                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                        Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                        • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                        • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                          DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                        Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                        • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                        • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -219,8 +201,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                          Socket License

                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                          The MIT License (MIT)

                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                          Copyright (c) 2012 Christian Lück, Cees-Jan Kiewiet, Jan Sorgalla, Chris Boden, Igor Wiedler

                                                                                                                                                                                                                                                                                                                                                                                                                          +

                                                                                                                                                                                                                                                                                                                                                                                                                          Copyright (c) 2012 Igor Wiedler, Chris Boden

                                                                                                                                                                                                                                                                                                                                                                                                                          Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -243,8 +224,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Socket
                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                          diff --git a/stream/changelog.html b/stream/changelog.html index e20e182a3..c4904d74b 100644 --- a/stream/changelog.html +++ b/stream/changelog.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -41,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                        Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                        • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                        • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -138,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                          DNS - v1.14.0 + v0.4.15 @@ -152,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          Cache - v1.2.0 + v0.5.0 @@ -161,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          ChildProcess - v0.6.7 + v0.5.2 @@ -170,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer - v1.11.0 + v1.5.0 @@ -179,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                        Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                        • - - HttpClient - - - v0.5.11 - - -
                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                        • - - SocketClient - - - v0.7.0 + v1.1.1
                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -221,11 +203,6 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                          Stream Changelog

                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2024 -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.4.0 - - - (2024-06-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
                                                                                                                                                                                                                                                                                                                                                                                                                            -(#179 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Full PHP 8.3 compatibility.
                                                                                                                                                                                                                                                                                                                                                                                                                            -(#172 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fix drain event of ThroughStream to handle potential race condition.
                                                                                                                                                                                                                                                                                                                                                                                                                            -(#171 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2023 -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.3.0 - - - (2023-06-16) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2021 -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.2.0 - - - (2021-07-11) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                          - -

                                                                                                                                                                                                                                                                                                                                                                                                                          A major new feature release, see release announcement.

                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Simplify usage by supporting new default loop.
                                                                                                                                                                                                                                                                                                                                                                                                                            -(#159 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                            // old (still supported)
                                                                                                                                                                                                                                                                                                                                                                                                                            -$stream = new ReadableResourceStream($resource, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                            -$stream = new WritabeResourceStream($resource, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                            -$stream = new DuplexResourceStream($resource, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                            -// new (using default loop)
                                                                                                                                                                                                                                                                                                                                                                                                                            -$stream = new ReadableResourceStream($resource);
                                                                                                                                                                                                                                                                                                                                                                                                                            -$stream = new WritabeResourceStream($resource);
                                                                                                                                                                                                                                                                                                                                                                                                                            -$stream = new DuplexResourceStream($resource);
                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite, use GitHub actions for continuous integration (CI),
                                                                                                                                                                                                                                                                                                                                                                                                                            -update PHPUnit config, run tests on PHP 8 and add full core team to the license.
                                                                                                                                                                                                                                                                                                                                                                                                                            -(#153, #156 and #157 by @SimonFrings and #154 by @WyriHaximus)

                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2020 -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.1.1 - - - (2020-05-04) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                            Fix: Fix faulty write buffer behavior when sending large data chunks over TLS (Mac OS X only).
                                                                                                                                                                                                                                                                                                                                                                                                                            -(#150 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                            Minor code style improvements to fix phpstan analysis warnings and
                                                                                                                                                                                                                                                                                                                                                                                                                            -add .gitattributes to exclude dev files from exports.
                                                                                                                                                                                                                                                                                                                                                                                                                            -(#140 by @flow-control and #144 by @reedy)

                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                            Improve test suite to run tests on PHP 7.4 and simplify test matrix.
                                                                                                                                                                                                                                                                                                                                                                                                                            -(#147 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                          • -
                                                                                                                                                                                                                                                                                                                                                                                                                          - -
                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - 2019 -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - - 1.1.0 - - - (2019-01-01) - - Release on GitHub - - -

                                                                                                                                                                                                                                                                                                                                                                                                                          - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                                                                                                                                                                          2018

                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -441,14 +231,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                            • First stable LTS release, now following SemVer.
                                                                                                                                                                                                                                                                                                                                                                                                                              We'd like to emphasize that this component is production ready and battle-tested.
                                                                                                                                                                                                                                                                                                                                                                                                                              We plan to support all long-term support (LTS) releases for at least 24 months,
                                                                                                                                                                                                                                                                                                                                                                                                                              so you have a rock-solid foundation to build on top of.
                                                                                                                                                                                                                                                                                                                                                                                                                            -

                                                                                                                                                                                                                                                                                                                                                                                                                            Contains no other changes, so it's actually fully compatible with the v0.7.7 release.

                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                            Contains no other changes, so it's actually fully compatible with the v0.7.7 release.


                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -466,11 +256,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                              • Improve test suite by fixing forward compatibility with upcoming EventLoop
                                                                                                                                                                                                                                                                                                                                                                                                                                releases, avoid risky tests and add test group to skip integration tests
                                                                                                                                                                                                                                                                                                                                                                                                                                relying on internet connection and apply appropriate test timeouts.
                                                                                                                                                                                                                                                                                                                                                                                                                                -(#128, #131 and #132 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                              • +(#128, #131 and #132 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -493,15 +283,15 @@

                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Work around reading from unbuffered pipe stream in legacy PHP < 5.4.28 and PHP < 5.5.12
                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#126 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Work around reading from unbuffered pipe stream in legacy PHP < 5.4.28 and PHP < 5.5.12
                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#126 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                  Improve test suite by simplifying test bootstrapping logic via Composer and
                                                                                                                                                                                                                                                                                                                                                                                                                                  test against PHP 7.2
                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#127 by @clue and #124 by @carusogabriel)

                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#127 by @clue and #124 by @carusogabriel)

                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -520,23 +310,23 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Igore excessive fopen() mode flags for WritableResourceStream
                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#119 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Igore excessive fopen() mode flags for WritableResourceStream
                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#119 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Fix forward compatibility with upcoming EventLoop releases
                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#121 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                    Fix: Fix forward compatibility with upcoming EventLoop releases
                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#121 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                    Restructure examples to ease getting started
                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#123 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                    Restructure examples to ease getting started
                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#123 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve test suite by adding forward compatibility with PHPUnit 6 and
                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve test suite by adding forward compatibility with PHPUnit 6 and
                                                                                                                                                                                                                                                                                                                                                                                                                                    ignore Mac OS X test failures for now until Travis tests work again
                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#122 by @Gabriel-Caruso and #120 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#122 by @gabriel-caruso and #120 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -555,21 +345,21 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                      Fix: Remove event listeners from CompositeStream once closed and
                                                                                                                                                                                                                                                                                                                                                                                                                                      -remove undocumented left-over close event argument
                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#116 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                      Fix: Remove event listeners from CompositeStream once closed and
                                                                                                                                                                                                                                                                                                                                                                                                                                      +remove undocumented left-over close event argument
                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#116 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                      Minor documentation improvements: Fix wrong class name in example,
                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                      Minor documentation improvements: Fix wrong class name in example,
                                                                                                                                                                                                                                                                                                                                                                                                                                      fix typos in README and
                                                                                                                                                                                                                                                                                                                                                                                                                                      fix forward compatibility with upcoming EventLoop releases in example
                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#113 by @docteurklein and #114 and #115 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#113 by @docteurklein and #114 and #115 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                    • -

                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite by running against Mac OS X on Travis
                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#112 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                                      Improve test suite by running against Mac OS X on Travis
                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#112 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -588,13 +378,13 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -612,9 +402,9 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -632,16 +422,16 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Add optional $writeChunkSize parameter to limit maximum number of
                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                            Feature: Add optional $writeChunkSize parameter to limit maximum number of
                                                                                                                                                                                                                                                                                                                                                                                                                                            bytes to write at once.
                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#105 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                            $stream = new WritableResourceStream(STDOUT, $loop, null, 8192);
                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#105 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                            $stream = new WritableResourceStream(STDOUT, $loop, null, 8192);
                                                                                                                                                                                                                                                                                                                                                                                                                                          • -

                                                                                                                                                                                                                                                                                                                                                                                                                                            Ignore HHVM test failures for now until Travis tests work again
                                                                                                                                                                                                                                                                                                                                                                                                                                            -(#106 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                            +

                                                                                                                                                                                                                                                                                                                                                                                                                                            Ignore HHVM test failures for now until Travis tests work again
                                                                                                                                                                                                                                                                                                                                                                                                                                            +(#106 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -660,78 +450,78 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                            • -

                                                                                                                                                                                                                                                                                                                                                                                                                                              Removed / BC break: Remove deprecated and unneeded functionality
                                                                                                                                                                                                                                                                                                                                                                                                                                              -(#45, #87, #90, #91 and #93 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Removed / BC break: Remove deprecated and unneeded functionality
                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#45, #87, #90, #91 and #93 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Remove deprecated Stream class, use DuplexResourceStream instead
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#87 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Remove deprecated Stream class, use DuplexResourceStream instead
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#87 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Remove public $buffer property, use new constructor parameters instead
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#91 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Remove public $buffer property, use new constructor parameters instead
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#91 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Remove public $stream property from all resource streams
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#90 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Remove public $stream property from all resource streams
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#90 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Remove undocumented and now unused ReadableStream and WritableStream
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#93 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Remove undocumented and now unused ReadableStream and WritableStream
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#93 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Remove BufferedSink
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#45 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Remove BufferedSink
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#45 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: Simplify ThroughStream by using data callback instead of
                                                                                                                                                                                                                                                                                                                                                                                                                                                -inheritance. It is now a direct implementation of DuplexStreamInterface.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#88 and #89 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                $through = new ThroughStream(function ($data) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                -    return json_encode($data) . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$through->on('data', $this->expectCallableOnceWith("[2, true]\n"));
                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                -$through->write(array(2, true));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: Simplify ThroughStream by using data callback instead of
                                                                                                                                                                                                                                                                                                                                                                                                                                                +inheritance. It is now a direct implementation of DuplexStreamInterface.
                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#88 and #89 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                $through = new ThroughStream(function ($data) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                +    return json_encode($data) . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                                                +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$through->on('data', $this->expectCallableOnceWith("[2, true]\n"));
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                +$through->write(array(2, true));
                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: The CompositeStream starts closed if either side is
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: The CompositeStream starts closed if either side is
                                                                                                                                                                                                                                                                                                                                                                                                                                                already closed and forwards pause to pipe source on first write attempt.
                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#96 and #103 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                If either side of the composite stream closes, it will also close the other
                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#96 and #103 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                If either side of the composite stream closes, it will also close the other
                                                                                                                                                                                                                                                                                                                                                                                                                                                side. We now also ensure that if either side is already closed during
                                                                                                                                                                                                                                                                                                                                                                                                                                                instantiation, it will also close the other side.

                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                BC break: Mark all classes as final and
                                                                                                                                                                                                                                                                                                                                                                                                                                                -mark internal API as private to discourage inheritance
                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#95 and #99 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                BC break: Mark all classes as final and
                                                                                                                                                                                                                                                                                                                                                                                                                                                +mark internal API as private to discourage inheritance
                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#95 and #99 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: Only emit error event for fatal errors
                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#92 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature / BC break: Only emit error event for fatal errors
                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#92 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                The error event was previously also allowed to be emitted for non-fatal
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                The error event was previously also allowed to be emitted for non-fatal
                                                                                                                                                                                                                                                                                                                                                                                                                                                errors, but our implementations actually only ever emitted this as a fatal
                                                                                                                                                                                                                                                                                                                                                                                                                                                error and then closed the stream.

                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Explicitly allow custom events and exclude any semantics
                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#97 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Feature: Explicitly allow custom events and exclude any semantics
                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#97 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Support legacy PHP 5.3 through PHP 7.1 and HHVM and improve usage documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#100 and #102 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Support legacy PHP 5.3 through PHP 7.1 and HHVM and improve usage documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#100 and #102 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                              • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                Actually require all dependencies so this is self-contained and improve
                                                                                                                                                                                                                                                                                                                                                                                                                                                +

                                                                                                                                                                                                                                                                                                                                                                                                                                                Actually require all dependencies so this is self-contained and improve
                                                                                                                                                                                                                                                                                                                                                                                                                                                forward compatibility with EventLoop v1.0 and v0.5
                                                                                                                                                                                                                                                                                                                                                                                                                                                -(#94 and #98 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                +(#94 and #98 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -750,54 +540,54 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix / BC break: Add DuplexResourceStream and deprecate Stream
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#85 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old (does still work for BC reasons)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$stream = new Stream($connection, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$stream = new DuplexResourceStream($connection, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Note that the DuplexResourceStream now rejects read-only or write-only
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix / BC break: Add DuplexResourceStream and deprecate Stream
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#85 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old (does still work for BC reasons)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$stream = new Stream($connection, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$stream = new DuplexResourceStream($connection, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Note that the DuplexResourceStream now rejects read-only or write-only
                                                                                                                                                                                                                                                                                                                                                                                                                                                  streams, so this may affect BC. If you want a read-only or write-only
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -resource, use ReadableResourceStream or WritableResourceStream instead of
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -DuplexResourceStream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +resource, use ReadableResourceStream or WritableResourceStream instead of
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +DuplexResourceStream.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC note: This class was previously called Stream. The Stream class still
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC note: This class was previously called Stream. The Stream class still
                                                                                                                                                                                                                                                                                                                                                                                                                                                  exists for BC reasons and will be removed in future versions of this package.

                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / BC break: Add WritableResourceStream (previously called Buffer)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#84 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$stream = new Buffer(STDOUT, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -$stream = new WritableResourceStream(STDOUT, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / BC break: Add WritableResourceStream (previously called Buffer)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#84 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  // old
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$stream = new Buffer(STDOUT, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +// new
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +$stream = new WritableResourceStream(STDOUT, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add ReadableResourceStream
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#83 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $stream = new ReadableResourceStream(STDIN, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature: Add ReadableResourceStream
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#83 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  $stream = new ReadableResourceStream(STDIN, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix / BC Break: Enforce using non-blocking I/O
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#46 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix / BC Break: Enforce using non-blocking I/O
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#46 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC note: This is known to affect process pipes on Windows which do not
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  BC note: This is known to affect process pipes on Windows which do not
                                                                                                                                                                                                                                                                                                                                                                                                                                                  support non-blocking I/O and could thus block the whole EventLoop previously.

                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix / BC break: Consistent semantics for
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -DuplexStreamInterface::end() to ensure it SHOULD also end readable side
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#86 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Feature / Fix / BC break: Consistent semantics for
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +DuplexStreamInterface::end() to ensure it SHOULD also end readable side
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#86 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Do not use unbuffered reads on pipe streams for legacy PHP < 5.4
                                                                                                                                                                                                                                                                                                                                                                                                                                                  -(#80 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  +

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fix: Do not use unbuffered reads on pipe streams for legacy PHP < 5.4
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +(#80 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -816,49 +606,49 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature / BC break: Consistent end event semantics (EOF)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#70 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    The end event will now only be emitted for a successful end, not if the
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -stream closes due to an unrecoverable error event or if you call close()
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature / BC break: Consistent end event semantics (EOF)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#70 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    The end event will now only be emitted for a successful end, not if the
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +stream closes due to an unrecoverable error event or if you call close()
                                                                                                                                                                                                                                                                                                                                                                                                                                                    explicitly.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -If you want to detect when the stream closes (terminates), use the close
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +If you want to detect when the stream closes (terminates), use the close
                                                                                                                                                                                                                                                                                                                                                                                                                                                    event instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    BC break: Remove custom (undocumented) full-drain event from Buffer
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#63 and #68 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    BC break: Remove custom (undocumented) full-drain event from Buffer
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#63 and #68 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    The full-drain event was undocumented and mostly used internally.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    The full-drain event was undocumented and mostly used internally.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Relying on this event has attracted some low-quality code in the past, so
                                                                                                                                                                                                                                                                                                                                                                                                                                                    we've removed this from the public API in order to work out a better
                                                                                                                                                                                                                                                                                                                                                                                                                                                    solution instead.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    If you want to detect when the buffer finishes flushing data to the stream,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -you may want to look into its end() method or the close event instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                    +you may want to look into its end() method or the close event instead.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature / BC break: Consistent event semantics and documentation,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature / BC break: Consistent event semantics and documentation,
                                                                                                                                                                                                                                                                                                                                                                                                                                                    explicitly state when events will be emitted and which arguments they
                                                                                                                                                                                                                                                                                                                                                                                                                                                    receive.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#73 and #69 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    The documentation now explicitly defines each event and its arguments.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#73 and #69 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    The documentation now explicitly defines each event and its arguments.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Custom events and event arguments are still supported.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Most notably, all defined events only receive inherently required event
                                                                                                                                                                                                                                                                                                                                                                                                                                                    arguments and no longer transmit the instance they are emitted on for
                                                                                                                                                                                                                                                                                                                                                                                                                                                    consistency and performance reasons.

                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                    // old (inconsistent and not supported by all implementations)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -$stream->on('data', function ($data, $stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    // process $data
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -// new (consistent throughout the whole ecosystem)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -$stream->on('data', function ($data) use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -    // process $data
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -});
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                    // old (inconsistent and not supported by all implementations)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +$stream->on('data', function ($data, $stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    // process $data
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +// new (consistent throughout the whole ecosystem)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +$stream->on('data', function ($data) use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +    // process $data
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +});
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    This mostly adds documentation (and thus some stricter, consistent
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    This mostly adds documentation (and thus some stricter, consistent
                                                                                                                                                                                                                                                                                                                                                                                                                                                    definitions) for the existing behavior, it does NOT define any major
                                                                                                                                                                                                                                                                                                                                                                                                                                                    changes otherwise.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Most existing code should be compatible with these changes, unless
                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -866,10 +656,10 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature / BC break: Consistent method semantics and documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#72 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature / BC break: Consistent method semantics and documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#72 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    This mostly adds documentation (and thus some stricter, consistent
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    This mostly adds documentation (and thus some stricter, consistent
                                                                                                                                                                                                                                                                                                                                                                                                                                                    definitions) for the existing behavior, it does NOT define any major
                                                                                                                                                                                                                                                                                                                                                                                                                                                    changes otherwise.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Most existing code should be compatible with these changes, unless
                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -877,15 +667,15 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Consistent pipe() semantics for closed and closing streams
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#71 from @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    The source stream will now always be paused via pause() when the
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Feature: Consistent pipe() semantics for closed and closing streams
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#71 from @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    The source stream will now always be paused via pause() when the
                                                                                                                                                                                                                                                                                                                                                                                                                                                    destination stream closes. Also, properly stop piping if the source
                                                                                                                                                                                                                                                                                                                                                                                                                                                    stream closes and remove all event forwarding.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve test suite by adding PHPUnit to require-dev and improving coverage.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#74 and #75 by @clue, #66 by @nawarian)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    +

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Improve test suite by adding PHPUnit to require-dev and improving coverage.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    +(#74 and #75 by @clue, #66 by @nawarian)

                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -904,13 +694,13 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: The Buffer can now be injected into the Stream (or be used standalone)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#62 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Fix: Forward close event only once for CompositeStream and ThroughStream
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#60 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Fix: Consistent close event behavior for Buffer
                                                                                                                                                                                                                                                                                                                                                                                                                                                    -(#61 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: The Buffer can now be injected into the Stream (or be used standalone)
                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#62 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Fix: Forward close event only once for CompositeStream and ThroughStream
                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#60 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Fix: Consistent close event behavior for Buffer
                                                                                                                                                                                                                                                                                                                                                                                                                                                      +(#61 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -933,15 +723,15 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: Support setting read buffer size to null (infinite)
                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#42 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Fix: Do not emit full-drain event if Buffer is closed during drain event
                                                                                                                                                                                                                                                                                                                                                                                                                                                      -(#55 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Feature: Support setting read buffer size to null (infinite)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#42 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Fix: Do not emit full-drain event if Buffer is closed during drain event
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +(#55 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Vastly improved performance by factor of 10x to 20x.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        Raise default buffer sizes to 64 KiB and simplify and improve error handling
                                                                                                                                                                                                                                                                                                                                                                                                                                                        and unneeded function calls.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -(#53, #55, #56 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • +(#53, #55, #56 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -959,16 +749,16 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Bug fix: Emit error event and close Stream when accessing the underlying
                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Emit error event and close Stream when accessing the underlying
                                                                                                                                                                                                                                                                                                                                                                                                                                                          stream resource fails with a permanent error.
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#52 and #40 by @clue, #25 by @lysenkobv)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Do not emit empty data event if nothing has been read (stream reached EOF)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#39 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Ignore empty writes to Buffer
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#51 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +(#52 and #40 by @clue, #25 by @lysenkobv) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Do not emit empty data event if nothing has been read (stream reached EOF)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#39 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Ignore empty writes to Buffer
                                                                                                                                                                                                                                                                                                                                                                                                                                                          +(#51 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Add benchmarking script to measure throughput in CI
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -(#41 by @clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +(#41 by @clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -991,11 +781,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Read buffer to 0 fixes error with libevent and large quantity of I/O (@mbonneau)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: No double-write during drain call (@arnaud-lb)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Support HHVM (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • -
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Adjust compatibility to 5.3 (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bug fix: Read buffer to 0 fixes error with libevent and large quantity of I/O (@mbonneau)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bug fix: No double-write during drain call (@arnaud-lb)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bug fix: Support HHVM (@clue)
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Adjust compatibility to 5.3 (@clue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1018,7 +808,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Added DuplexStreamInterface
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Stream sets stream resources to non-blocking
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Fixed potential race condition in pipe
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • @@ -1039,7 +829,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Bug fix: v0.3.4 changes merged for v0.4.1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1058,7 +848,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Bug fix: [Stream] Fixed 100% CPU spike from non-empty write buffer on closed stream
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1077,7 +867,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • BC break: Bump minimum PHP version to PHP 5.4, remove 5.3 specific hacks
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • BC break: Update to Evenement 2.0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Dependency: Autoloading and filesystem structure now PSR-4 instead of PSR-0
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • @@ -1103,7 +893,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: [Stream] Correctly detect closed connections
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1122,7 +912,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bug fix: [Stream] Make sure CompositeStream is closed properly
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1141,8 +931,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bug fix: [Stream] Allow any ReadableStreamInterface on BufferedSink::createPromise()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Bug fix: [Stream] Allow any ReadableStreamInterface on BufferedSink::createPromise()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1160,7 +950,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Feature: [Stream] Factory method for BufferedSink
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1184,7 +974,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1203,8 +993,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • Feature: Make BufferedSink trigger progress events on the promise (@jsor)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • Feature: Make BufferedSink trigger progress events on the promise (@jsor)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @@ -1222,7 +1012,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: Added ThroughStream, CompositeStream, ReadableStream and WritableStream
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • Feature: Added BufferedSink
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @@ -1242,7 +1032,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -1261,7 +1051,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @@ -1280,8 +1070,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • Bug fix: Check for EOF in Buffer::write()
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • Bug fix: Check for EOF in Buffer::write()

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @@ -1299,7 +1089,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • Version bump
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @@ -1318,7 +1108,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • Bug fix: Testing and functional against PHP >= 5.3.3 and <= 5.3.8
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @@ -1337,7 +1127,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • First tagged release
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @@ -1358,8 +1148,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Stream
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                diff --git a/stream/index.html b/stream/index.html index d5d331c58..abf89575e 100644 --- a/stream/index.html +++ b/stream/index.html @@ -5,7 +5,8 @@ - Stream - ReactPHP + Stream: +Stream - ReactPHP @@ -20,13 +21,13 @@ - - + + - - - + + + @@ -40,7 +41,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              +
                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                        Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                                                                                                                                                        • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                        • +
                                                                                                                                                                                                                                                                                                                                                                                                                        • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                        • @@ -137,7 +143,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                          DNS - v1.14.0 + v0.4.15 @@ -151,7 +157,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          Cache - v1.2.0 + v0.5.0 @@ -160,7 +166,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +175,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +184,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                          Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                          PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                        Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                        - -

                                                                                                                                                                                                                                                                                                                                                                                                                        Stream usage

                                                                                                                                                                                                                                                                                                                                                                                                                        +

                                                                                                                                                                                                                                                                                                                                                                                                                        +Stream usage

                                                                                                                                                                                                                                                                                                                                                                                                                        ReactPHP uses the concept of "streams" throughout its ecosystem to provide a consistent higher-level abstraction for processing streams of arbitrary data contents and size. @@ -302,7 +285,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                        Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      • WritableStreamInterface
                                                                                                                                                                                                                                                                                                                                                                                                                      • DuplexStreamInterface
                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      ReadableStreamInterface

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +ReadableStreamInterface

                                                                                                                                                                                                                                                                                                                                                                                                                      The ReadableStreamInterface is responsible for providing an interface for read-only streams and the readable side of duplex streams.

                                                                                                                                                                                                                                                                                                                                                                                                                      Besides defining a few methods, this interface also implements the @@ -322,13 +306,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      is out of scope for this interface, so you may also have to refer to the documentation of such a higher-level implementation.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      data event

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +data event

                                                                                                                                                                                                                                                                                                                                                                                                                      The data event will be emitted whenever some data was read/received from this source stream. The event receives a single mixed argument for incoming data.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('data', function ($data) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    echo $data;
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('data', function ($data) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    echo $data;
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      This event MAY be emitted any number of times, which may be zero times if this stream does not send any data at all. It SHOULD not be emitted after an end or close event.

                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -345,12 +330,13 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      data in chunks that may be anywhere between single-byte values to several dozens of kilobytes. You may want to apply a higher-level protocol to these low-level data chunks in order to achieve proper message framing.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      end event

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +end event

                                                                                                                                                                                                                                                                                                                                                                                                                      The end event will be emitted once the source stream has successfully reached the end of the stream (EOF).

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    echo 'END';
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    echo 'END';
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      This event SHOULD be emitted once or never at all, depending on whether a successful end was detected. It SHOULD NOT be emitted after a previous end or close event. @@ -372,13 +358,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      This event defines a successful end reading from a source stream, while the end() method defines writing a successful end to a destination stream.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      error event

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +error event

                                                                                                                                                                                                                                                                                                                                                                                                                      The error event will be emitted once a fatal error occurs, usually while trying to read from this stream. The event receives a single Exception argument for the error instance.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $server->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $server->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      This event SHOULD be emitted once the stream detects a fatal error, such as a fatal transmission error or after an unexpected data or premature end event. @@ -398,11 +385,12 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      how the writable side of the stream also implements an error event. In other words, an error may occur while either reading or writing the stream which should result in the same error processing.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      close event

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +close event

                                                                                                                                                                                                                                                                                                                                                                                                                      The close event will be emitted once the stream closes (terminates).

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    echo 'CLOSED';
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    echo 'CLOSED';
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      This event SHOULD be emitted once or never at all, depending on whether the stream ever terminates. It SHOULD NOT be emitted after a previous close event.

                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -421,17 +409,18 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      In other words, after receiving this event, the stream MUST switch into non-writable AND non-readable mode, see also isWritable(). Note that this event should not be confused with the end event.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      isReadable()

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +isReadable()

                                                                                                                                                                                                                                                                                                                                                                                                                      The isReadable(): bool method can be used to check whether this stream is in a readable state (not closed already).

                                                                                                                                                                                                                                                                                                                                                                                                                      This method can be used to check if the stream still accepts incoming data events or if it is ended or closed already. Once the stream is non-readable, no further data or end events SHOULD be emitted.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      assert($stream->isReadable() === false);
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->on('data', assertNeverCalled());
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->on('end', assertNeverCalled());
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      assert($stream->isReadable() === false);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->on('data', assertNeverCalled());
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->on('end', assertNeverCalled());

                                                                                                                                                                                                                                                                                                                                                                                                                      A successfully opened stream always MUST start in readable mode.

                                                                                                                                                                                                                                                                                                                                                                                                                      Once the stream ends or closes, it MUST switch to non-readable mode. This can happen any time, explicitly through close() or @@ -442,7 +431,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      how the writable side of the stream also implements an isWritable() method. Unless this is a half-open duplex stream, they SHOULD usually have the same return value.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      pause()

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +pause()

                                                                                                                                                                                                                                                                                                                                                                                                                      The pause(): void method can be used to pause reading incoming data events.

                                                                                                                                                                                                                                                                                                                                                                                                                      Removes the data source file descriptor from the event loop. This @@ -451,86 +441,90 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      in paused state.

                                                                                                                                                                                                                                                                                                                                                                                                                      Once the stream is paused, no futher data or end events SHOULD be emitted.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->on('data', assertShouldNeverCalled());
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->on('end', assertShouldNeverCalled());
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->on('data', assertShouldNeverCalled());
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->on('end', assertShouldNeverCalled());

                                                                                                                                                                                                                                                                                                                                                                                                                      This method is advisory-only, though generally not recommended, the stream MAY continue emitting data events.

                                                                                                                                                                                                                                                                                                                                                                                                                      You can continue processing events by calling resume() again.

                                                                                                                                                                                                                                                                                                                                                                                                                      Note that both methods can be called any number of times, in particular calling pause() more than once SHOULD NOT have any effect.

                                                                                                                                                                                                                                                                                                                                                                                                                      See also resume().

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      resume()

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +resume()

                                                                                                                                                                                                                                                                                                                                                                                                                      The resume(): void method can be used to resume reading incoming data events.

                                                                                                                                                                                                                                                                                                                                                                                                                      Re-attach the data source after a previous pause().

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -Loop::addTimer(1.0, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    $stream->resume();
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->pause();
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$loop->addTimer(1.0, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    $stream->resume();
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      Note that both methods can be called any number of times, in particular calling resume() without a prior pause() SHOULD NOT have any effect.

                                                                                                                                                                                                                                                                                                                                                                                                                      See also pause().

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      pipe()

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +pipe()

                                                                                                                                                                                                                                                                                                                                                                                                                      The pipe(WritableStreamInterface $dest, array $options = []) method can be used to pipe all the data from this readable source into the given writable destination.

                                                                                                                                                                                                                                                                                                                                                                                                                      Automatically sends all incoming data to the destination. Automatically throttles the source based on what the destination can handle.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->pipe($dest);

                                                                                                                                                                                                                                                                                                                                                                                                                      Similarly, you can also pipe an instance implementing DuplexStreamInterface into itself in order to write back all the data that is received. This may be a useful feature for a TCP/IP echo service:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $connection->pipe($connection);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $connection->pipe($connection);

                                                                                                                                                                                                                                                                                                                                                                                                                      This method returns the destination stream as-is, which can be used to set up chains of piped streams:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->pipe($decodeGzip)->pipe($filterBadWords)->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->pipe($decodeGzip)->pipe($filterBadWords)->pipe($dest);

                                                                                                                                                                                                                                                                                                                                                                                                                      By default, this will call end() on the destination stream once the source stream emits an end event. This can be disabled like this:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->pipe($dest, array('end' => false));
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->pipe($dest, array('end' => false));

                                                                                                                                                                                                                                                                                                                                                                                                                      Note that this only applies to the end event. If an error or explicit close event happens on the source stream, you'll have to manually close the destination stream:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                      -$source->on('close', function () use ($dest) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    $dest->end('BYE!');
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                      +$source->on('close', function () use ($dest) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    $dest->end('BYE!');
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      If the source stream is not readable (closed state), then this is a NO-OP.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      -$source->pipe($dest); // NO-OP
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      +$source->pipe($dest); // NO-OP

                                                                                                                                                                                                                                                                                                                                                                                                                      If the destinantion stream is not writable (closed state), then this will simply throttle (pause) the source stream:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $dest->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      -$source->pipe($dest); // calls $source->pause()
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $dest->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      +$source->pipe($dest); // calls $source->pause()

                                                                                                                                                                                                                                                                                                                                                                                                                      Similarly, if the destination stream is closed while the pipe is still active, it will also throttle (pause) the source stream:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                      -$dest->close(); // calls $source->pause()
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $source->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                      +$dest->close(); // calls $source->pause()

                                                                                                                                                                                                                                                                                                                                                                                                                      Once the pipe is set up successfully, the destination stream MUST emit a pipe event with this source stream an event argument.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      close()

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +close()

                                                                                                                                                                                                                                                                                                                                                                                                                      The close(): void method can be used to close the stream (forcefully).

                                                                                                                                                                                                                                                                                                                                                                                                                      This method can be used to (forcefully) close the stream.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->close();

                                                                                                                                                                                                                                                                                                                                                                                                                      Once the stream is closed, it SHOULD emit a close event. Note that this event SHOULD NOT be emitted more than once, in particular if this method is called multiple times.

                                                                                                                                                                                                                                                                                                                                                                                                                      After calling this method, the stream MUST switch into a non-readable mode, see also isReadable(). This means that no further data or end events SHOULD be emitted.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      -assert($stream->isReadable() === false);
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->on('data', assertNeverCalled());
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->on('end', assertNeverCalled());
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      +assert($stream->isReadable() === false);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->on('data', assertNeverCalled());
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->on('end', assertNeverCalled());

                                                                                                                                                                                                                                                                                                                                                                                                                      If this stream is a DuplexStreamInterface, you should also notice how the writable side of the stream also implements a close() method. In other words, after calling this method, the stream MUST switch into non-writable AND non-readable mode, see also isWritable(). Note that this method should not be confused with the end() method.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      WritableStreamInterface

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +WritableStreamInterface

                                                                                                                                                                                                                                                                                                                                                                                                                      The WritableStreamInterface is responsible for providing an interface for write-only streams and the writable side of duplex streams.

                                                                                                                                                                                                                                                                                                                                                                                                                      Besides defining a few methods, this interface also implements the @@ -550,12 +544,13 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      is out of scope for this interface, so you may also have to refer to the documentation of such a higher-level implementation.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      drain event

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +drain event

                                                                                                                                                                                                                                                                                                                                                                                                                      The drain event will be emitted whenever the write buffer became full previously and is now ready to accept more data.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('drain', function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    echo 'Stream is now ready to accept more data';
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('drain', function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    echo 'Stream is now ready to accept more data';
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      This event SHOULD be emitted once every time the buffer became full previously and is now ready to accept more data. In other words, this event MAY be emitted any number of times, which may @@ -563,21 +558,22 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      This event SHOULD NOT be emitted if the buffer has not become full previously.

                                                                                                                                                                                                                                                                                                                                                                                                                      This event is mostly used internally, see also write() for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      pipe event

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +pipe event

                                                                                                                                                                                                                                                                                                                                                                                                                      The pipe event will be emitted whenever a readable stream is pipe()d into this stream. The event receives a single ReadableStreamInterface argument for the source stream.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('pipe', function (ReadableStreamInterface $source) use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    echo 'Now receiving piped data';
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -    // explicitly close target if source emits an error
                                                                                                                                                                                                                                                                                                                                                                                                                      -    $source->on('error', function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -        $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      -    });
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$source->pipe($stream);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('pipe', function (ReadableStreamInterface $source) use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    echo 'Now receiving piped data';
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +    // explicitly close target if source emits an error
                                                                                                                                                                                                                                                                                                                                                                                                                      +    $source->on('error', function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +        $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      +    });
                                                                                                                                                                                                                                                                                                                                                                                                                      +});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$source->pipe($stream);

                                                                                                                                                                                                                                                                                                                                                                                                                      This event MUST be emitted once for each readable stream that is successfully piped into this destination stream. In other words, this event MAY be emitted any number of times, which may @@ -585,13 +581,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      This event MUST NOT be emitted if either the source is not readable (closed already) or this destination is not writable (closed already).

                                                                                                                                                                                                                                                                                                                                                                                                                      This event is mostly used internally, see also pipe() for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      error event

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +error event

                                                                                                                                                                                                                                                                                                                                                                                                                      The error event will be emitted once a fatal error occurs, usually while trying to write to this stream. The event receives a single Exception argument for the error instance.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('error', function (Exception $e) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    echo 'Error: ' . $e->getMessage() . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      This event SHOULD be emitted once the stream detects a fatal error, such as a fatal transmission error. It SHOULD NOT be emitted after a previous error or close event. @@ -608,11 +605,12 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      how the readable side of the stream also implements an error event. In other words, an error may occur while either reading or writing the stream which should result in the same error processing.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      close event

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +close event

                                                                                                                                                                                                                                                                                                                                                                                                                      The close event will be emitted once the stream closes (terminates).

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    echo 'CLOSED';
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->on('close', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    echo 'CLOSED';
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      This event SHOULD be emitted once or never at all, depending on whether the stream ever terminates. It SHOULD NOT be emitted after a previous close event.

                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -630,16 +628,17 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      In other words, after receiving this event, the stream MUST switch into non-writable AND non-readable mode, see also isReadable(). Note that this event should not be confused with the end event.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      isWritable()

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +isWritable()

                                                                                                                                                                                                                                                                                                                                                                                                                      The isWritable(): bool method can be used to check whether this stream is in a writable state (not closed already).

                                                                                                                                                                                                                                                                                                                                                                                                                      This method can be used to check if the stream still accepts writing any data or if it is ended or closed already. Writing any data to a non-writable stream is a NO-OP:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      assert($stream->isWritable() === false);
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->write('end'); // NO-OP
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->end('end'); // NO-OP
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      assert($stream->isWritable() === false);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->write('end'); // NO-OP
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->end('end'); // NO-OP

                                                                                                                                                                                                                                                                                                                                                                                                                      A successfully opened stream always MUST start in writable mode.

                                                                                                                                                                                                                                                                                                                                                                                                                      Once the stream ends or closes, it MUST switch to non-writable mode. This can happen any time, explicitly through end() or close() or @@ -650,7 +649,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      how the readable side of the stream also implements an isReadable() method. Unless this is a half-open duplex stream, they SHOULD usually have the same return value.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      write()

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +write()

                                                                                                                                                                                                                                                                                                                                                                                                                      The write(mixed $data): bool method can be used to write some data into the stream.

                                                                                                                                                                                                                                                                                                                                                                                                                      A successful write MUST be confirmed with a boolean true, which means @@ -670,7 +670,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      data until the buffer drains. The stream SHOULD send a drain event once the buffer is ready to accept more data.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      Similarly, if the stream is not writable (already in a closed state) +

                                                                                                                                                                                                                                                                                                                                                                                                                      Similarly, if the the stream is not writable (already in a closed state) it MUST NOT process the given $data and SHOULD return false, indicating that the caller should stop sending data.

                                                                                                                                                                                                                                                                                                                                                                                                                      The given $data argument MAY be of mixed type, but it's usually @@ -686,14 +686,15 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      data in chunks that may be anywhere between single-byte values to several dozens of kilobytes. You may want to apply a higher-level protocol to these low-level data chunks in order to achieve proper message framing.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      end()

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +end()

                                                                                                                                                                                                                                                                                                                                                                                                                      The end(mixed $data = null): void method can be used to successfully end the stream (after optionally sending some final data).

                                                                                                                                                                                                                                                                                                                                                                                                                      This method can be used to successfully end the stream, i.e. close the stream after sending out all data that is currently buffered.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->write('hello');
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->write('world');
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->end();
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->write('hello');
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->write('world');
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->end();

                                                                                                                                                                                                                                                                                                                                                                                                                      If there's no data currently buffered and nothing to be flushed, then this method MAY close() the stream immediately.

                                                                                                                                                                                                                                                                                                                                                                                                                      If there's still data in the buffer that needs to be flushed first, then @@ -711,21 +712,21 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      before ending the stream. If a non-null value is given as $data, then this method will behave just like calling write($data) before ending with no data.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      // shorter version
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->end('bye');
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -// same as longer version
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->write('bye');
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->end();
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      // shorter version
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->end('bye');
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +// same as longer version
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->write('bye');
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->end();

                                                                                                                                                                                                                                                                                                                                                                                                                      After calling this method, the stream MUST switch into a non-writable mode, see also isWritable(). This means that no further writes are possible, so any additional write() or end() calls have no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->end();
                                                                                                                                                                                                                                                                                                                                                                                                                      -assert($stream->isWritable() === false);
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->write('nope'); // NO-OP
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->end(); // NO-OP
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->end();
                                                                                                                                                                                                                                                                                                                                                                                                                      +assert($stream->isWritable() === false);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->write('nope'); // NO-OP
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->end(); // NO-OP

                                                                                                                                                                                                                                                                                                                                                                                                                      If this stream is a DuplexStreamInterface, calling this method SHOULD also end its readable side, unless the stream supports half-open mode. In other words, after calling this method, these streams SHOULD switch @@ -736,13 +737,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      special care may have to be taken to ensure a following call to the resume() method SHOULD NOT continue emitting readable events.

                                                                                                                                                                                                                                                                                                                                                                                                                      Note that this method should not be confused with the close() method.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      close()

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +close()

                                                                                                                                                                                                                                                                                                                                                                                                                      The close(): void method can be used to close the stream (forcefully).

                                                                                                                                                                                                                                                                                                                                                                                                                      This method can be used to forcefully close the stream, i.e. close the stream without waiting for any buffered data to be flushed. If there's still data in the buffer, this data SHOULD be discarded.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->close();

                                                                                                                                                                                                                                                                                                                                                                                                                      Once the stream is closed, it SHOULD emit a close event. Note that this event SHOULD NOT be emitted more than once, in particular if this method is called multiple times.

                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -750,25 +752,26 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      mode, see also isWritable(). This means that no further writes are possible, so any additional write() or end() calls have no effect.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      -assert($stream->isWritable() === false);
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->write('nope'); // NO-OP
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->end(); // NO-OP
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      +assert($stream->isWritable() === false);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->write('nope'); // NO-OP
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->end(); // NO-OP

                                                                                                                                                                                                                                                                                                                                                                                                                      Note that this method should not be confused with the end() method. Unlike the end() method, this method does not take care of any existing buffers and simply discards any buffer contents. Likewise, this method may also be called after calling end() on a stream in order to stop waiting for the stream to flush its final data.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->end();
                                                                                                                                                                                                                                                                                                                                                                                                                      -Loop::addTimer(1.0, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream->end();
                                                                                                                                                                                                                                                                                                                                                                                                                      +$loop->addTimer(1.0, function () use ($stream) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    $stream->close();
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      If this stream is a DuplexStreamInterface, you should also notice how the readable side of the stream also implements a close() method. In other words, after calling this method, the stream MUST switch into non-writable AND non-readable mode, see also isReadable().

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      DuplexStreamInterface

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +DuplexStreamInterface

                                                                                                                                                                                                                                                                                                                                                                                                                      The DuplexStreamInterface is responsible for providing an interface for duplex streams (both readable and writable).

                                                                                                                                                                                                                                                                                                                                                                                                                      It builds on top of the existing interfaces for readable and writable streams @@ -795,7 +798,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      See also ReadableStreamInterface and WritableStreamInterface for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      Creating streams

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +Creating streams

                                                                                                                                                                                                                                                                                                                                                                                                                      ReactPHP uses the concept of "streams" throughout its ecosystem, so that many higher-level consumers of this package only deal with stream usage. @@ -826,41 +830,37 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      which may or may not be supported by all EventLoop implementations. As an alternative, you may want to use higher-level libraries listed above.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      ReadableResourceStream

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +ReadableResourceStream

                                                                                                                                                                                                                                                                                                                                                                                                                      The ReadableResourceStream is a concrete implementation of the ReadableStreamInterface for PHP's stream resources.

                                                                                                                                                                                                                                                                                                                                                                                                                      This can be used to represent a read-only resource like a file stream opened in readable mode or a stream such as STDIN:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream = new ReadableResourceStream(STDIN);
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    echo 'END';
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream = new ReadableResourceStream(STDIN, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->on('data', function ($chunk) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    echo $chunk;
                                                                                                                                                                                                                                                                                                                                                                                                                      +});
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->on('end', function () {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    echo 'END';
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      See also ReadableStreamInterface for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                      The first parameter given to the constructor MUST be a valid stream resource that is opened in reading mode (e.g. fopen() mode r). Otherwise, it will throw an InvalidArgumentException:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws InvalidArgumentException
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream = new ReadableResourceStream(false);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws InvalidArgumentException
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream = new ReadableResourceStream(false, $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                      See also the DuplexResourceStream for read-and-write stream resources otherwise.

                                                                                                                                                                                                                                                                                                                                                                                                                      Internally, this class tries to enable non-blocking mode on the stream resource which may not be supported for all stream resources. Most notably, this is not supported by pipes on Windows (STDIN etc.). If this fails, it will throw a RuntimeException:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws RuntimeException on Windows
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream = new ReadableResourceStream(STDIN);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws RuntimeException on Windows
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream = new ReadableResourceStream(STDIN, $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                      Once the constructor is called with a valid stream resource, this class will take care of the underlying stream resource. You SHOULD only use its public API and SHOULD NOT interfere with the underlying stream resource manually.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                      This class takes an optional int|null $readChunkSize parameter that controls the maximum buffer size in bytes to read at once from the stream. You can use a null value here in order to apply its default value. @@ -874,7 +874,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      This should read until the stream resource is not readable anymore (i.e. underlying buffer drained), note that this does not neccessarily mean it reached EOF.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream = new ReadableResourceStream(STDIN, null, 8192);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream = new ReadableResourceStream(STDIN, $loop, 8192);

                                                                                                                                                                                                                                                                                                                                                                                                                      PHP bug warning: If the PHP process has explicitly been started without a STDIN stream, then trying to read from STDIN may return data from @@ -882,32 +882,29 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      stream like php test.php < /dev/null instead of php test.php <&-. See #81 for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      Changelog: As of v1.2.0 the $loop parameter can be omitted (or skipped with a -null value) to use the default loop.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      WritableResourceStream

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +WritableResourceStream

                                                                                                                                                                                                                                                                                                                                                                                                                      The WritableResourceStream is a concrete implementation of the WritableStreamInterface for PHP's stream resources.

                                                                                                                                                                                                                                                                                                                                                                                                                      This can be used to represent a write-only resource like a file stream opened in writable mode or a stream such as STDOUT or STDERR:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream = new WritableResourceStream(STDOUT);
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->write('hello!');
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->end();
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream = new WritableResourceStream(STDOUT, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->write('hello!');
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->end();

                                                                                                                                                                                                                                                                                                                                                                                                                      See also WritableStreamInterface for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                      The first parameter given to the constructor MUST be a valid stream resource that is opened for writing. Otherwise, it will throw an InvalidArgumentException:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws InvalidArgumentException
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream = new WritableResourceStream(false);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws InvalidArgumentException
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream = new WritableResourceStream(false, $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                      See also the DuplexResourceStream for read-and-write stream resources otherwise.

                                                                                                                                                                                                                                                                                                                                                                                                                      Internally, this class tries to enable non-blocking mode on the stream resource which may not be supported for all stream resources. Most notably, this is not supported by pipes on Windows (STDOUT, STDERR etc.). If this fails, it will throw a RuntimeException:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws RuntimeException on Windows
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream = new WritableResourceStream(STDOUT);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws RuntimeException on Windows
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream = new WritableResourceStream(STDOUT, $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                      Once the constructor is called with a valid stream resource, this class will take care of the underlying stream resource. You SHOULD only use its public API and SHOULD NOT interfere with the underlying @@ -918,16 +915,11 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      For this, it uses an in-memory buffer string to collect all outstanding writes. This buffer has a soft-limit applied which defines how much data it is willing to accept before the caller SHOULD stop sending further data.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                      This class takes an optional int|null $writeBufferSoftLimit parameter that controls this maximum buffer size in bytes. You can use a null value here in order to apply its default value. This value SHOULD NOT be changed unless you know what you're doing.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream = new WritableResourceStream(STDOUT, null, 8192);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream = new WritableResourceStream(STDOUT, $loop, 8192);

                                                                                                                                                                                                                                                                                                                                                                                                                      This class takes an optional int|null $writeChunkSize parameter that controls this maximum buffer size in bytes to write at once to the stream. You can use a null value here in order to apply its default value. @@ -938,27 +930,24 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      currently available. This can be -1 which means "write everything available" to the underlying stream resource.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream = new WritableResourceStream(STDOUT, null, null, 8192);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stream = new WritableResourceStream(STDOUT, $loop, null, 8192);

                                                                                                                                                                                                                                                                                                                                                                                                                      See also write() for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      Changelog: As of v1.2.0 the $loop parameter can be omitted (or skipped with a -null value) to use the default loop.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      DuplexResourceStream

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +DuplexResourceStream

                                                                                                                                                                                                                                                                                                                                                                                                                      The DuplexResourceStream is a concrete implementation of the DuplexStreamInterface for PHP's stream resources.

                                                                                                                                                                                                                                                                                                                                                                                                                      This can be used to represent a read-and-write resource like a file stream opened in read and write mode mode or a stream such as a TCP/IP connection:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $conn = stream_socket_client('tcp://google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream = new DuplexResourceStream($conn);
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->write('hello!');
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream->end();
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $conn = stream_socket_client('tcp://google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream = new DuplexResourceStream($conn, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->write('hello!');
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream->end();

                                                                                                                                                                                                                                                                                                                                                                                                                      See also DuplexStreamInterface for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                      The first parameter given to the constructor MUST be a valid stream resource that is opened for reading and writing. Otherwise, it will throw an InvalidArgumentException:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws InvalidArgumentException
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream = new DuplexResourceStream(false);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws InvalidArgumentException
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream = new DuplexResourceStream(false, $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                      See also the ReadableResourceStream for read-only and the WritableResourceStream for write-only stream resources otherwise.

                                                                                                                                                                                                                                                                                                                                                                                                                      @@ -966,17 +955,12 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      which may not be supported for all stream resources. Most notably, this is not supported by pipes on Windows (STDOUT, STDERR etc.). If this fails, it will throw a RuntimeException:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws RuntimeException on Windows
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream = new DuplexResourceStream(STDOUT);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      // throws RuntimeException on Windows
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream = new DuplexResourceStream(STDOUT, $loop);

                                                                                                                                                                                                                                                                                                                                                                                                                      Once the constructor is called with a valid stream resource, this class will take care of the underlying stream resource. You SHOULD only use its public API and SHOULD NOT interfere with the underlying stream resource manually.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      This class takes an optional LoopInterface|null $loop parameter that can be used to -pass the event loop instance to use for this object. You can use a null value -here in order to use the default loop. -This value SHOULD NOT be given unless you're sure you want to explicitly use a -given event loop instance.

                                                                                                                                                                                                                                                                                                                                                                                                                      This class takes an optional int|null $readChunkSize parameter that controls the maximum buffer size in bytes to read at once from the stream. You can use a null value here in order to apply its default value. @@ -990,8 +974,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      This should read until the stream resource is not readable anymore (i.e. underlying buffer drained), note that this does not neccessarily mean it reached EOF.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $conn = stream_socket_client('tcp://google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream = new DuplexResourceStream($conn, null, 8192);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $conn = stream_socket_client('tcp://google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream = new DuplexResourceStream($conn, $loop, 8192);

                                                                                                                                                                                                                                                                                                                                                                                                                      Any write() calls to this class will not be performed instantly, but will be performed asynchronously, once the EventLoop reports the stream resource is ready to accept data. @@ -1004,58 +988,56 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      This value SHOULD NOT be changed unless you know what you're doing.

                                                                                                                                                                                                                                                                                                                                                                                                                      If you want to change the write buffer soft limit, you can pass an instance of WritableResourceStream like this:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $conn = stream_socket_client('tcp://google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                      -$buffer = new WritableResourceStream($conn, null, 8192);
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stream = new DuplexResourceStream($conn, null, null, $buffer);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $conn = stream_socket_client('tcp://google.com:80');
                                                                                                                                                                                                                                                                                                                                                                                                                      +$buffer = new WritableResourceStream($conn, $loop, 8192);
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stream = new DuplexResourceStream($conn, $loop, null, $buffer);

                                                                                                                                                                                                                                                                                                                                                                                                                      See also WritableResourceStream for more details.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      Changelog: As of v1.2.0 the $loop parameter can be omitted (or skipped with a -null value) to use the default loop.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      ThroughStream

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +ThroughStream

                                                                                                                                                                                                                                                                                                                                                                                                                      The ThroughStream implements the DuplexStreamInterface and will simply pass any data you write to it through to its readable end.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $through = new ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                      -$through->on('data', $this->expectCallableOnceWith('hello'));
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$through->write('hello');
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $through = new ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                      +$through->on('data', $this->expectCallableOnceWith('hello'));
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$through->write('hello');

                                                                                                                                                                                                                                                                                                                                                                                                                      Similarly, the end() method will end the stream and emit an end event and then close() the stream. The close() method will close the stream and emit a close event. Accordingly, this is can also be used in a pipe() context like this:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $through = new ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                      -$source->pipe($through)->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $through = new ThroughStream();
                                                                                                                                                                                                                                                                                                                                                                                                                      +$source->pipe($through)->pipe($dest);

                                                                                                                                                                                                                                                                                                                                                                                                                      Optionally, its constructor accepts any callable function which will then be used to filter any data written to it. This function receives a single data argument as passed to the writable side and must return the data as it will be passed to its readable end:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $through = new ThroughStream('strtoupper');
                                                                                                                                                                                                                                                                                                                                                                                                                      -$source->pipe($through)->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $through = new ThroughStream('strtoupper');
                                                                                                                                                                                                                                                                                                                                                                                                                      +$source->pipe($through)->pipe($dest);

                                                                                                                                                                                                                                                                                                                                                                                                                      Note that this class makes no assumptions about any data types. This can be used to convert data, for example for transforming any structured data into a newline-delimited JSON (NDJSON) stream like this:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $through = new ThroughStream(function ($data) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    return json_encode($data) . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      -$through->on('data', $this->expectCallableOnceWith("[2, true]\n"));
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$through->write(array(2, true));
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $through = new ThroughStream(function ($data) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    return json_encode($data) . PHP_EOL;
                                                                                                                                                                                                                                                                                                                                                                                                                      +});
                                                                                                                                                                                                                                                                                                                                                                                                                      +$through->on('data', $this->expectCallableOnceWith("[2, true]\n"));
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$through->write(array(2, true));

                                                                                                                                                                                                                                                                                                                                                                                                                      The callback function is allowed to throw an Exception. In this case, the stream will emit an error event and then close() the stream.

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $through = new ThroughStream(function ($data) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    if (!is_string($data)) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -        throw new \UnexpectedValueException('Only strings allowed');
                                                                                                                                                                                                                                                                                                                                                                                                                      -    }
                                                                                                                                                                                                                                                                                                                                                                                                                      -    return $data;
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      -$through->on('error', $this->expectCallableOnce()));
                                                                                                                                                                                                                                                                                                                                                                                                                      -$through->on('close', $this->expectCallableOnce()));
                                                                                                                                                                                                                                                                                                                                                                                                                      -$through->on('data', $this->expectCallableNever()));
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$through->write(2);
                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      CompositeStream

                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $through = new ThroughStream(function ($data) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    if (!is_string($data)) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +        throw new \UnexpectedValueException('Only strings allowed');
                                                                                                                                                                                                                                                                                                                                                                                                                      +    }
                                                                                                                                                                                                                                                                                                                                                                                                                      +    return $data;
                                                                                                                                                                                                                                                                                                                                                                                                                      +});
                                                                                                                                                                                                                                                                                                                                                                                                                      +$through->on('error', $this->expectCallableOnce()));
                                                                                                                                                                                                                                                                                                                                                                                                                      +$through->on('close', $this->expectCallableOnce()));
                                                                                                                                                                                                                                                                                                                                                                                                                      +$through->on('data', $this->expectCallableNever()));
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$through->write(2);
                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +CompositeStream

                                                                                                                                                                                                                                                                                                                                                                                                                      The CompositeStream implements the DuplexStreamInterface and can be used to create a single duplex stream from two individual streams implementing @@ -1064,14 +1046,14 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      This is useful for some APIs which may require a single DuplexStreamInterface or simply because it's often more convenient to work with a single stream instance like this:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $stdin = new ReadableResourceStream(STDIN);
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stdout = new WritableResourceStream(STDOUT);
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stdio = new CompositeStream($stdin, $stdout);
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$stdio->on('data', function ($chunk) use ($stdio) {
                                                                                                                                                                                                                                                                                                                                                                                                                      -    $stdio->write('You said: ' . $chunk);
                                                                                                                                                                                                                                                                                                                                                                                                                      -});
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $stdin = new ReadableResourceStream(STDIN, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stdout = new WritableResourceStream(STDOUT, $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stdio = new CompositeStream($stdin, $stdout);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$stdio->on('data', function ($chunk) use ($stdio) {
                                                                                                                                                                                                                                                                                                                                                                                                                      +    $stdio->write('You said: ' . $chunk);
                                                                                                                                                                                                                                                                                                                                                                                                                      +});

                                                                                                                                                                                                                                                                                                                                                                                                                      This is a well-behaving stream which forwards all stream events from the underlying streams and forwards all streams calls to the underlying streams.

                                                                                                                                                                                                                                                                                                                                                                                                                      If you write() to the duplex stream, it will simply write() to the @@ -1083,13 +1065,18 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      will also close. If either of the two input streams is already closed while constructing the duplex stream, it will close() the other side and return a closed stream.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      Usage

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +Usage

                                                                                                                                                                                                                                                                                                                                                                                                                      The following example can be used to pipe the contents of a source file into a destination file without having to ever read the whole file into memory:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      $source = new React\Stream\ReadableResourceStream(fopen('source.txt', 'r'));
                                                                                                                                                                                                                                                                                                                                                                                                                      -$dest = new React\Stream\WritableResourceStream(fopen('destination.txt', 'w'));
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -$source->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $loop = new React\EventLoop\StreamSelectLoop;
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$source = new React\Stream\ReadableResourceStream(fopen('source.txt', 'r'), $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                      +$dest = new React\Stream\WritableResourceStream(fopen('destination.txt', 'w'), $loop);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$source->pipe($dest);
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      +$loop->run();

                                                                                                                                                                                                                                                                                                                                                                                                                      Note that this example uses fopen() for illustration purposes only. This should not be used in a truly async program because the filesystem is @@ -1097,30 +1084,34 @@

                                                                                                                                                                                                                                                                                                                                                                                                                      Stream

                                                                                                                                                                                                                                                                                                                                                                                                                      See also creating streams for more sophisticated examples.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      Install

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +Install

                                                                                                                                                                                                                                                                                                                                                                                                                      The recommended way to install this library is through Composer. New to Composer?

                                                                                                                                                                                                                                                                                                                                                                                                                      This project follows SemVer. This will install the latest supported version:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      composer require react/stream:^1.4
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $ composer require react/stream:^1.0

                                                                                                                                                                                                                                                                                                                                                                                                                      See also the CHANGELOG for details about version upgrades.

                                                                                                                                                                                                                                                                                                                                                                                                                      This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.3 through current PHP 8+ and HHVM. +extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. It's highly recommended to use PHP 7+ for this project due to its vast performance improvements.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      Tests

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +Tests

                                                                                                                                                                                                                                                                                                                                                                                                                      To run the test suite, you first need to clone this repo and then install all dependencies through Composer:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      composer install
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $ composer install

                                                                                                                                                                                                                                                                                                                                                                                                                      To run the test suite, go to the project root and run:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      vendor/bin/phpunit
                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $ php vendor/bin/phpunit

                                                                                                                                                                                                                                                                                                                                                                                                                      The test suite also contains a number of functional integration tests that rely on a stable internet connection. If you do not want to run these, they can simply be skipped like this:

                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      vendor/bin/phpunit --exclude-group internet
                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      License

                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      $ php vendor/bin/phpunit --exclude-group internet
                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +License

                                                                                                                                                                                                                                                                                                                                                                                                                      MIT, see LICENSE file.

                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      More

                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      +More

                                                                                                                                                                                                                                                                                                                                                                                                                      • See creating streams for more information on how streams are created in real-world applications.
                                                                                                                                                                                                                                                                                                                                                                                                                      • @@ -1135,8 +1126,8 @@

                                                                                                                                                                                                                                                                                                                                                                                                                        Stream
                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                        diff --git a/stream/license.html b/stream/license.html index e985565e8..0b9baacad 100644 --- a/stream/license.html +++ b/stream/license.html @@ -20,13 +20,13 @@ - - + + - - - + + + @@ -40,7 +40,7 @@
                                                                                                                                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                                                                                                                                        -

                                                                                                                                                                                                                                                                                                                                                                                                                      + +
                                                                                                                                                                                                                                                                                                                                                                                                                      +

                                                                                                                                                                                                                                                                                                                                                                                                                      Protocol Components

                                                                                                                                                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                                                                                                                                                      • HTTP - v1.11.0 + v0.8.3 + + +
                                                                                                                                                                                                                                                                                                                                                                                                                      • +
                                                                                                                                                                                                                                                                                                                                                                                                                      • + + HTTPClient + + + v0.5.9
                                                                                                                                                                                                                                                                                                                                                                                                                      • @@ -137,7 +142,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                        Network Components

                                                                                                                                                                                                                                                                                                                                                                                                                        DNS - v1.14.0 + v0.4.15 @@ -151,7 +156,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                        Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                        Cache - v1.2.0 + v0.5.0 @@ -160,7 +165,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                        Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                        ChildProcess - v0.6.7 + v0.5.2 @@ -169,7 +174,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                        Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                        PromiseTimer - v1.11.0 + v1.5.0 @@ -178,30 +183,7 @@

                                                                                                                                                                                                                                                                                                                                                                                                                        Utility Components

                                                                                                                                                                                                                                                                                                                                                                                                                        PromiseStream - v1.7.0 - - - -
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                                                                                                                                      -

                                                                                                                                                                                                                                                                                                                                                                                                                      Legacy Components

                                                                                                                                                                                                                                                                                                                                                                                                                      -